[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/7] xen/events: reduce externally visible helper functions


  • To: Juergen Gross <jgross@xxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>
  • Date: Mon, 13 Nov 2023 15:53:28 +0000
  • Accept-language: en-US, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ETMtRESNJmr+goj+uKvRRM2zLqwLPCkv27sDTe2V00g=; b=j7s834UTT5EAMsvA1ynxtIp3Ce59ryCLm6CSmQgueX7n/ETfuFtJfO116YoAkX6ZGnDR6UrL6wsnM1mD0iyg/t3yZdy+dclNpTxE2IhxD6ohzcE+XBgfW7h28du+ebmMcUWso5muX5IZJTvcVK+OEXNVlo6aG0X/zIJtH6RyB9JWsofh69kwKtezfxP+zgydAFU3UxEfYuMkJH9nrFrcYjNRkfSF7BYupMI9d6iFw0Bg2AQNkEzzAd1MsIBq1G1ZGyPkRCoTJi4uYoWf1VcC5L7FXM/T4UOfXJ2A2KcFCc2VD6pndiYDuJSZE5RxSmkQAjjDGbmpTqjdZ4mWFay/MQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ufh+ui458jT/tIE1XYuSiugPrmyQfXtkoNgREXLC76ey05cKDB3+9sj/t2qsTSQfMZBnb3GGka3UMahthL2+FLlp63OnyZAz0cPJTeayluYkHCzt9UI/96UFyHs+PoCeDvGhQY2dl2btWcdw9/F5P3OflktlDj/cAaVdSJ5ort2MLSxdV06hQj8E326DfUltfIrdeV5l6Mhcl8M4szBI0Y5Xh/HQH8z0PiOEN/ZQWBaP3LtOTRVfrJIwaOu4vk6J1frfGmTRFhmOTN2TBW0mq1qBTohP5CludYlFwY/RSWyfAbwhuPEO62JnH8iHeq3PthwfADUuXOR9FitcHArKXg==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 13 Nov 2023 15:53:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZ//oKavD9kfGMLE6r3CZA/iY8BbB4kyCA
  • Thread-topic: [PATCH 3/7] xen/events: reduce externally visible helper functions


On 16.10.23 09:28, Juergen Gross wrote:


Hello Juergen

> get_evtchn_to_irq() has only one external user while irq_from_evtchn()
> provides the same functionality and is exported for a wider user base.
> Modify the only external user of get_evtchn_to_irq() to use
> irq_from_evtchn() instead and make get_evtchn_to_irq() static.
> 
> evtchn_from_irq() and irq_from_virq() have a single external user and
> can easily be combined to a new helper irq_evtchn_from_virq() allowing
> to drop irq_from_virq() and to make evtchn_from_irq() static.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>


Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>

Two NITs *NOT* directly related to current patch below.


> ---
>   drivers/xen/events/events_2l.c       |  8 ++++----
>   drivers/xen/events/events_base.c     | 13 +++++++++----
>   drivers/xen/events/events_internal.h |  1 -
>   include/xen/events.h                 |  4 ++--
>   4 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c
> index b8f2f971c2f0..e3585330cf98 100644
> --- a/drivers/xen/events/events_2l.c
> +++ b/drivers/xen/events/events_2l.c
> @@ -171,11 +171,11 @@ static void evtchn_2l_handle_events(unsigned cpu, 
> struct evtchn_loop_ctrl *ctrl)
>       int i;
>       struct shared_info *s = HYPERVISOR_shared_info;
>       struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
> +     evtchn_port_t evtchn;
>   
>       /* Timer interrupt has highest priority. */
> -     irq = irq_from_virq(cpu, VIRQ_TIMER);
> +     irq = irq_evtchn_from_virq(cpu, VIRQ_TIMER, &evtchn);
>       if (irq != -1) {
> -             evtchn_port_t evtchn = evtchn_from_irq(irq);

Most users of evtchn_from_irq() check returned evtchn via VALID_EVTCHN() 
as it might be 0. But this user doesn't.


>               word_idx = evtchn / BITS_PER_LONG;
>               bit_idx = evtchn % BITS_PER_LONG;
>               if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx))
> @@ -328,9 +328,9 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
>       for (i = 0; i < EVTCHN_2L_NR_CHANNELS; i++) {
>               if (sync_test_bit(i, BM(sh->evtchn_pending))) {
>                       int word_idx = i / BITS_PER_EVTCHN_WORD;
> -                     printk("  %d: event %d -> irq %d%s%s%s\n",
> +                     printk("  %d: event %d -> irq %u%s%s%s\n",

checkpatch.pl says:

WARNING: printk() should include KERN_<LEVEL> facility level
#37: FILE: drivers/xen/events/events_2l.c:331:
+                       printk("  %d: event %d -> irq %u%s%s%s\n",


>                              cpu_from_evtchn(i), i,
> -                            get_evtchn_to_irq(i),
> +                            irq_from_evtchn(i),
>                              sync_test_bit(word_idx, 
> BM(&v->evtchn_pending_sel))
>                              ? "" : " l2-clear",
>                              !sync_test_bit(i, BM(sh->evtchn_mask))
> 

[snip]

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.