From: Reinette Chatre <reinette.chatre@intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
Alex Williamson <alex.williamson@redhat.com>
Cc: "jgg@nvidia.com" <jgg@nvidia.com>,
"yishaih@nvidia.com" <yishaih@nvidia.com>,
"shameerali.kolothum.thodi@huawei.com"
<shameerali.kolothum.thodi@huawei.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"darwi@linutronix.de" <darwi@linutronix.de>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Jiang, Dave" <dave.jiang@intel.com>,
"Liu, Jing2" <jing2.liu@intel.com>,
"Raj, Ashok" <ashok.raj@intel.com>,
"Yu, Fenghua" <fenghua.yu@intel.com>,
"tom.zanussi@linux.intel.com" <tom.zanussi@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 7/8] vfio/pci: Support dynamic MSI-x
Date: Tue, 4 Apr 2023 10:29:14 -0700 [thread overview]
Message-ID: <ad8c9137-bd57-4862-46c8-2c77a21b3419@intel.com> (raw)
In-Reply-To: <BN9PR11MB527626CAE4BA7ECB64F0E9728C939@BN9PR11MB5276.namprd11.prod.outlook.com>
Hi Kevin,
On 4/3/2023 8:51 PM, Tian, Kevin wrote:
>> From: Alex Williamson <alex.williamson@redhat.com>
>> Sent: Tuesday, April 4, 2023 11:19 AM
>>>
>>> Thank you very much for your guidance. I will digest this some more and
>>> see how wrappers could be used. In the mean time while trying to think
>> how
>>> to unify this code I do think there is an issue in this patch in that
>>> the get_cached_msi_msg()/pci_write_msi_msg()
>>> should not be in an else branch.
>>>
>>> Specifically, I think it needs to be:
>>> if (msix) {
>>> if (irq == -EINVAL) {
>>> /* dynamically allocate interrupt */
>>> }
>>> get_cached_msi_msg(irq, &msg);
>>> pci_write_msi_msg(irq, &msg);
>>> }
>>
>> Yes, that's looked wrong to me all along, I think that resolves it.
>> Thanks,
>>
>
> Do you mind elaborating why this change is required? I thought
> pci_msix_alloc_irq_at() will compose a new msi message to write
> hence no need to get cached value again in that case...
With this change an interrupt allocated via pci_msix_alloc_irq_at()
is treated the same as an interrupt allocated via pci_alloc_irq_vectors().
get_cached_msi_msg()/pci_write_msi_msg() is currently called for
every allocated interrupt and this snippet intends to maintain
this behavior.
One flow I considered that made me think this is fixing a bug is
as follows:
Scenario A (current behavior):
- host/user enables vectors 0, 1, 2 ,3 ,4
- kernel allocates all interrupts via pci_alloc_irq_vectors()
- get_cached_msi_msg()/pci_write_msi_msg() is called for each interrupt
Scenario B (this series):
- host/user enables vector 0
- kernel allocates interrupt 0 via pci_alloc_irq_vectors()
- get_cached_msi_msg()/pci_write_msi_msg() is called for interrupt 0
- host/user enables vector 1
- kernel allocates interrupt 1 via pci_msix_alloc_irq_at()
- get_cached_msi_msg()/pci_write_msi_msg() is NOT called for interrupt 1
/* This seems a bug since host may expect same outcome as in scenario A */
I am not familiar with how the MSI messages are composed though and I surely
could have gotten this wrong. I would like to learn more after you considered
the motivation for this change.
Reinette
next prev parent reply other threads:[~2023-04-04 17:31 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 21:53 [PATCH V2 0/8] vfio/pci: Support dynamic allocation of MSI-X interrupts Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 1/8] vfio/pci: Consolidate irq cleanup on MSI/MSI-X disable Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 2/8] vfio/pci: Remove negative check on unsigned vector Reinette Chatre
2023-03-30 20:26 ` Alex Williamson
2023-03-30 22:32 ` Reinette Chatre
2023-03-30 22:54 ` Alex Williamson
2023-03-30 23:54 ` Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 3/8] vfio/pci: Prepare for dynamic interrupt context storage Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 4/8] vfio/pci: Use xarray for " Reinette Chatre
2023-04-07 7:21 ` Liu, Jing2
2023-04-07 16:44 ` Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 5/8] vfio/pci: Remove interrupt context counter Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 6/8] vfio/pci: Move to single error path Reinette Chatre
2023-03-28 21:53 ` [PATCH V2 7/8] vfio/pci: Support dynamic MSI-x Reinette Chatre
2023-03-29 2:48 ` kernel test robot
2023-03-29 14:42 ` Reinette Chatre
2023-03-29 22:10 ` Reinette Chatre
2023-03-29 2:58 ` kernel test robot
2023-03-30 22:40 ` Alex Williamson
2023-03-30 22:42 ` Alex Williamson
2023-03-31 17:49 ` Reinette Chatre
2023-03-31 22:24 ` Alex Williamson
2023-04-03 17:31 ` Reinette Chatre
2023-04-03 20:22 ` Alex Williamson
2023-04-03 22:50 ` Reinette Chatre
2023-04-04 3:18 ` Alex Williamson
2023-04-04 3:51 ` Tian, Kevin
2023-04-04 17:29 ` Reinette Chatre [this message]
2023-04-04 18:43 ` Alex Williamson
2023-04-04 20:46 ` Reinette Chatre
2023-04-04 16:54 ` Reinette Chatre
2023-04-04 18:24 ` Alex Williamson
2023-04-06 20:13 ` Reinette Chatre
2023-03-31 10:02 ` Liu, Jing2
2023-03-31 13:51 ` Alex Williamson
2023-04-04 3:19 ` Liu, Jing2
2023-03-28 21:53 ` [PATCH V2 8/8] vfio/pci: Clear VFIO_IRQ_INFO_NORESIZE for MSI-X Reinette Chatre
2023-03-29 3:29 ` kernel test robot
2023-03-29 3:29 ` kernel test robot
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=ad8c9137-bd57-4862-46c8-2c77a21b3419@intel.com \
--to=reinette.chatre@intel.com \
--cc=alex.williamson@redhat.com \
--cc=ashok.raj@intel.com \
--cc=darwi@linutronix.de \
--cc=dave.jiang@intel.com \
--cc=fenghua.yu@intel.com \
--cc=jgg@nvidia.com \
--cc=jing2.liu@intel.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=tglx@linutronix.de \
--cc=tom.zanussi@linux.intel.com \
--cc=yishaih@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®