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

Re: [PATCH v1 0/3] vPCI capabilities filtering


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 15 Aug 2023 07:59:25 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wtW5c5IFqRJ6t9+Wlp7QzAZc5xG3DbDYvu2/vusObE8=; b=TC+kE12tuHY2wBOonaiXITGghk9hA2MN+ZgLaEx8JuOZJ62t7odUcC3+BJ4YIKgP037uWYyZVGWBlDNUon1fbTYTPTybFSiPwA2TLjQ53n+hiF1P42ojZu0mDGgnj37Lp2gFtH2pDh476lBtP1zqL59fETJos0JTC74o3ZRCRouHnYCW8VjVns8tKRtuUoYU+lDdQe+ERJ8cqkAAdubjKne6EtApaGc1PAhZqDzixNiV3M/XYqwZouAPCOkhLyzMWdxL8Ct6Uh0AZ10AJ0UU6Sv5AMXjS1eUvQY6YxIPX4tfr9J1W9rXjZ7PLHEqS+uFFw4T2zoIx9hs3pPUqW/Gcw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZkZWF+aWoe4Ffa/VpZm0kPCzkRVmiKBhFGqV7OcYp3tlhXJrg2NnfEyK/aMvAbWsBfANNMR2J5C7iepVpkWZOD6AKpTFKTwcUem/ct3PeW2Sz0N5Bcy9vrwOCtXh+l8whxU1ZxnnDn42prkzWynih/WK8HSN18DR4QTyT1ahfbtxIkSahcVBJ9k0gytbVVDkKVDkDlM228SW5uFzEfPD6TfisHbgXRLRjTM5u5+Wp3MP3afLHtMoshaf+5BnVl1/NHJJRnFgVIsJe8L5S9vMJ9JoGQn4Ikr0c+Xsk/aPHoH+ddnYHpAnKpOfJCMRnsmGUKbSGTRLPmofCOvgZZ2fg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 15 Aug 2023 05:59:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.08.2023 23:11, Stewart Hildebrand wrote:
> On 8/14/23 09:59, Jan Beulich wrote:
>> On 10.08.2023 21:12, Stewart Hildebrand wrote:
>>> This small series enables vPCI to filter which PCI capabilites we expose to 
>>> a
>>> domU. This series adds vPCI register handlers within
>>> xen/drivers/vpci/header.c:init_bars(), along with some supporting functions.
>>>
>>> Note there are minor rebase conflicts with the in-progress vPCI series [1].
>>> These conflicts fall into the category of functions and code being added
>>> adjacent to one another, so are easily resolved. I did not identify any
>>> dependency on the vPCI locking work, and the two series deal with different
>>> aspects of emulating the PCI header.
>>>
>>> Future work may involve adding handlers for more registers in the vPCI 
>>> header,
>>> such as STATUS, VID/DID, etc.
>>>
>>> [1] 
>>> https://lists.xenproject.org/archives/html/xen-devel/2023-07/msg01281.html
>>>
>>> Stewart Hildebrand (3):
>>>   xen/vpci: add vpci_hw_read8 helper
>>>   xen/vpci: add vpci_read_val helper
>>>   xen/vpci: header: filter PCI capabilities
>>
>> I'm not convinced of the split here: Seeing the new helpers in isolation
>> leaves entirely open what they're to be used for.
> 
> Our code review guide [2] (section "General Patterns") explicitly suggests 
> separating independent helper functions into (a) separate patch(es). Whether 
> it is one patch per helper, or all helpers in a single patch appears 
> ambiguous.
> That said, I'd still be happy to squash all these into a single patch to 
> avoid the transient dead code situation - please confirm.

I'm not the maintainer of this code, so my confirmation is of limited
value, but yes, in the case here I'm of the clear opinion that
separating out the helper functions is not helpful. Not doing so will
then also ...

>> Plus besides introducing
>> dead code (even if only transiently), you also introduce cf_check marked
>> code which isn't really called indirectly from anywhere. Yet we'd like to
>> keep the amount of these markings down (in the final binary, not so much
>> in source code).
> 
> The helper functions will be added to struct vpci_register objects, where 
> they will be called from vpci.c:vpci_read():
> 
>     val = r->read(pdev, r->offset, r->private);
> 
> Does this justify the cf_check attribute?

It not only justifies the attribute, it actually demands it, yes. By
the time these use sites appear.

> If so, should the cf_check attributes rather be added once the helpers are 
> actually used in the patch "xen/vpci: header: filter PCI capabilities"?

... deal with this, by rendering remark and question void.

> [2] http://xenbits.xenproject.org/governance/code-review-guide.html

I'll try to remember to add a topic to the next Community Call's
agenda. Actively suggesting to (even if just transiently) introduce
dead code is in direct conflict with the Misra work. Plus, if such
helpers were static, it also suggests actively breaking the build,
again just transiently of course.

Jan



 


Rackspace

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