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

Re: [PATCH v2 3/3] x86/msi: clear initial MSI-X state on boot


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Mar 2023 14:38:22 +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=snYl6+DUNGmGFIGv1Ug0RJEqdcUwcyyoylDMzhHIMwQ=; b=S7Be5czlXMKAnZrhM03OG9pOxXu/92uZtQ7JZtd/qvJE8BI1sn2YbvLJdt5ff8/OFngsFRNMQjNW66Kg7CxErLG3F3GYaqjnA77LHVJgdY7iLWlaeG8WoIgCJpumbomtLSL8P5cd/RzFpz7fXpafb0cF+w6g1QBdtVrJkVqw6sQP9Ls5n+wdvGEb1p97Iq74M/qG0P0o9bd10/j4Zc9TA3Y/1AD9GIk11m/rw6r+Z0vh+F2WPZ4pAzaB7VZWG/8u+LREu23C4aEJZqth52AVt8EdC1KBfkU1lL9cpZPkzyllZ9HMkDP7AWMSeq8hGkpPdiCntBA1JyDW0CHWa0f4YQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayHrlTElz90GpviE58jAypkr4f5qkQpXtAtMutx9dBIgnSsCZa/WXND7I/6YbyO55B5zd4pGrhmWfK/UytpKUvRq50oFrsMULX3uqMInZ4LqCl+XG2XoJnPiIYHXKcGMdiYecHoPtqAeVl6JsrM9B6+93cQbke5NcrQT9Yv2288eePx9vjHXXVUWRPjRWvSuH4G0+dcBkD5xecVUX9jlGwIWZJzNtHQ8lJN/3e0YxxzRq0BL8Uv36MAPxi6bb316cANqQLsIiLHK940gjozzXiRr5N/ca0M6d37VSn9KsQ7gqmELOQvu+nnUg0R8cbutKp2MueoXiMswQxE+wwVVGA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Jason Andryuk <jandryuk@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 28 Mar 2023 12:38:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.03.2023 14:07, Marek Marczykowski-Górecki wrote:
> On Tue, Mar 28, 2023 at 01:37:14PM +0200, Roger Pau Monné wrote:
>> On Sat, Mar 25, 2023 at 03:49:24AM +0100, Marek Marczykowski-Górecki wrote:
>>> --- a/xen/drivers/passthrough/msi.c
>>> +++ b/xen/drivers/passthrough/msi.c
>>> @@ -48,6 +48,13 @@ int pdev_msi_init(struct pci_dev *pdev)
>>>          ctrl = pci_conf_read16(pdev->sbdf, msix_control_reg(pos));
>>>          msix->nr_entries = msix_table_size(ctrl);
>>>  
>>> +        /*
>>> +         * Clear both ENABLE and MASKALL, pci_reset_msix_state() relies on 
>>> this
>>> +         * initial state.
>>> +         */
>>> +        ctrl &= ~(PCI_MSIX_FLAGS_ENABLE|PCI_MSIX_FLAGS_MASKALL);
>>> +        pci_conf_write16(pdev->sbdf, msix_control_reg(pos), ctrl);
>>
>> Should you make this conditional to them being set in the first place:
>>
>> if ( ctrl & (PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL) )
>> {
>>     ...
>>
>> We should avoid the extra access if possible (specially if it's to
>> write the same value that has been read).
>>
>> I would even move this before the msix_table_size() call, so the
>> handling of ctrl is closer together.
>>
>> Would it also be worth to print a debug message that the initial
>> device state seems inconsistent?
> 
> That may make sense. XENLOG_WARNING? XENLOG_DEBUG?

Warning I would say, as this isn't liable to repeat frequently for the
same device. And it's helpful to see even in release build runs using
default log levels.

Jan



 


Rackspace

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