All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: jgross@suse.com, Bertrand.Marquis@arm.com, julien@xen.org,
	Volodymyr_Babchuk@epam.com,
	Stefano Stabellini <stefano.stabellini@xilinx.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH v2 2/5] xen: export get_free_port
Date: Fri, 14 Jan 2022 08:02:13 +0100	[thread overview]
Message-ID: <758b304f-4df7-4fa7-fa0a-8ebbebb661d5@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2201131713140.19362@ubuntu-linux-20-04-desktop>

On 14.01.2022 02:20, Stefano Stabellini wrote:
> On Thu, 13 Jan 2022, Jan Beulich wrote:
>> On 13.01.2022 01:58, Stefano Stabellini wrote:
>>> --- a/xen/common/event_channel.c
>>> +++ b/xen/common/event_channel.c
>>> @@ -232,7 +232,7 @@ int evtchn_allocate_port(struct domain *d, evtchn_port_t port)
>>>      return 0;
>>>  }
>>>  
>>> -static int get_free_port(struct domain *d)
>>> +int get_free_port(struct domain *d)
>>
>> The name of the function isn't really suitable for being non-static.
>> Can't we fold its functionality back into evtchn_allocate_port() (or
>> the other way around, depending on the perspective you want to take)
>> in case the caller passes in port 0? (Btw., it is imo wrong for the
>> loop over ports to start at 0, when it is part of the ABI that port
>> 0 is always invalid. evtchn_init() also better wouldn't depend on it
>> being the only party to successfully invoke the function getting back
>> port 0.)
> 
> I agree that "get_free_port" is not a great name for a non-static
> function. Also, it should be noted that for the sake of this patch
> series I could just call evtchn_allocate_port(d, 1) given that it is the
> first evtchn to be allocated. So maybe, that's the best way forward?
> 
> 
> To address your specific suggestion, in my opinion it would be best to
> have two different functions to allocate a new port:
> - one with a specific evtchn_port_t port parameter
> - one without it (meaning: "I don't care about the number")
> 
> Folding the functionality of "give me any number" when 0 is passed to
> evtchn_allocate_port() doesn't seem to be an improvement to the API to
> me.

I view it the other way around - that way the function would actually
start matching its name. So far it's more like marking a given port
number as in use, rather than allocating.

> That said, I am still OK with making the suggested change if that's what
> you prefer.

Given experience, hoping for others to voice an opinion isn't likely
to become reality.

Jan



  reply	other threads:[~2022-01-14  7:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  0:58 [XEN PATCH v2 0/5] dom0less PV drivers Stefano Stabellini
2022-01-13  0:58 ` [XEN PATCH v2 1/5] xen: introduce xen,enhanced dom0less property Stefano Stabellini
2022-01-13  8:29   ` Bertrand Marquis
2022-01-14  1:21     ` Stefano Stabellini
2022-01-13  9:09   ` Luca Fancellu
2022-01-13 23:02     ` Stefano Stabellini
2022-01-13  0:58 ` [XEN PATCH v2 2/5] xen: export get_free_port Stefano Stabellini
2022-01-13  8:19   ` Jan Beulich
2022-01-14  1:20     ` Stefano Stabellini
2022-01-14  7:02       ` Jan Beulich [this message]
2022-01-23 11:02   ` Julien Grall
2022-01-25  1:10     ` Stefano Stabellini
2022-01-25  8:22       ` Jan Beulich
2022-01-25 18:02         ` Julien Grall
2022-01-25 22:49         ` Stefano Stabellini
2022-01-25 23:14           ` Julien Grall
2022-01-26  1:03             ` Stefano Stabellini
2022-01-26  7:30               ` Jan Beulich
2022-01-26  9:50                 ` Julien Grall
2022-01-27  1:50                   ` Stefano Stabellini
2022-01-27  9:51                     ` Julien Grall
2022-01-27 12:07                       ` Jan Beulich
2022-01-27 13:31                         ` Julien Grall
2022-01-28  1:38                           ` Stefano Stabellini
2022-01-28  7:09                             ` Jan Beulich
2022-01-26  7:26           ` Jan Beulich
2022-01-13  0:58 ` [XEN PATCH v2 3/5] xen/arm: configure dom0less domain for enabling xenstore after boot Stefano Stabellini
2022-01-13 10:15   ` Bertrand Marquis
2022-01-23 11:06     ` Julien Grall
2022-01-26  1:02       ` Stefano Stabellini
2022-01-13  0:58 ` [XEN PATCH v2 4/5] xenstored: send an evtchn notification on introduce_domain Stefano Stabellini
2022-01-13 10:18   ` Bertrand Marquis
2022-01-13  0:58 ` [XEN PATCH v2 5/5] tools: add example application to initialize dom0less PV drivers Stefano Stabellini
2022-01-13 10:30   ` Bertrand Marquis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=758b304f-4df7-4fa7-fa0a-8ebbebb661d5@suse.com \
    --to=jbeulich@suse.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.