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

Re: [PATCH] tools/libxc: use uint32_t for pirq in xc_domain_irq_permission

  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 7 Jul 2021 15:14:23 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-SenderADCheck; bh=65JL41WTVgv4+rHK0UnlBXiPMK5sbKJAZAsMq5ZAbpA=; b=kip8yTxEafAaufvhECo9amLXjlr98ndVXu+Z3Xa0jmsl6PAuZHbiCeOJBVOZrcQG6MVJtA116HxEJ+gWwWDtg2bmT1MIZBLd+9qyf4M7/bttn/1r+MaR6QoC16DEuQ7B7aj6VZoMvM37p4qabF89y2kvyt3tLNyiEQHvvl4QxV0Ri2AnbyltHhJh7GPjSxoRtQXd1xJlIoYaB5Bp5KRwdIvYmfVhdyy5SbPfs3qOSGjWsv80M3/THntnS1cuVIYY2XZMWdrE40+GAzCgg9GMpCi2MTKnd0xwJAXpzQ1E3O6QMp6k6y96cGGBW0rXkS3Ovt574CK4OyPKItbFeiH97Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cc7DH7KPQXjd+56fbX+kPA2e6WtNWzDMbqXJ7iOF9d0aZ5rAGnCskpmkjXh3Sm7/rcqcrT37cyYfnA1x48yGpBqlcdwS2u2iAl1mVxTJf4BV0O6H2gpwQ1wJM5YbjIgjJzgW6iy7q28tdrzK9Rhcp+RRzR2sG3PEEmZjIyJraVOnhgZ0VAH76M+TNXoXDWuu29rpcX3elAin1NRhKhrJbZ+BRQY48NWnhU8riO/qOnQluVlcMWirJX3Z3SjirkpM1pUM57Mu2hW2MNHoVFrwggIyFzk9GvmGh0Gt1JMvIpHdR1NY4u+xPnGvm0L/MHX8JChgqOiJPG1pD4B1Aoo0HA==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: iwj@xxxxxxxxxxxxxx, wl@xxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, sstabellini@xxxxxxxxxx, jgross@xxxxxxxx, christian.lindig@xxxxxxxxxx, dave@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
  • Delivery-date: Wed, 07 Jul 2021 13:14:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.07.2021 14:59, Julien Grall wrote:
> On 07/07/2021 13:54, Jan Beulich wrote:
>> On 07.07.2021 14:51, Julien Grall wrote:
>>> On 07/07/2021 02:02, Igor Druzhinin wrote:
>>>> Current unit8_t for pirq argument in this interface is too restrictive
>>>> causing failures on modern hardware with lots of GSIs. That extends down to
>>>> XEN_DOMCTL_irq_permission ABI structure where it needs to be fixed up
>>>> as well. Internal Xen structures appear to be fine. Existing users of
>>>> the interface in tree (libxl, ocaml and python bindings) are already using
>>>> int for pirq representation that should be wide enough.
>>> By "int", I am assuming you imply "signed int", is that correct?
>>> If so, should the function xc_domain_irq_permission() interface take an
>>> int in parameter and check it is not negative?
>> Please let's not make things worse than they are, the more that
> Well, what I am trying to prevent is surprise where the caller 
> mistakenly pass a negative value that will be interpreted as a positive 
> value...

This happens all the time when converting from signed to unsigned
perhaps just internally.

> Such issues are beyong annoying to debug...

No worse than any other out-of-bounds value, I would say.

>  > ./CODING_STYLE is unambiguous in cases like this one.
> Hmmm... The coding style mention the fixed size but nothing about the 
> signedness of the type...

Oh, sorry, yes. The adjustment for this even pre-dates the two
patches to ./CODING_STYLE that I've on record as pending for
nearly two years.

> The alternative suggestion is to keep a unsigned type but check the bit 
> 31 is not set.

Why? Why not bit 30 or bit 27? There's nothing special about
bit 31 in an unsigned number. You'll get an error from the
underlying hypercall for any out of bounds values, not just
ones with bit 31, 30, or 27 set.




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