From: Wei Liu <wei.liu@kernel.org>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>
Cc: kys@microsoft.com, haiyangz@microsoft.com,
sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com,
bhelgaas@google.com, bjorn.andersson@linaro.org,
linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: hv: Fix hv_arch_irq_unmask() for multi-MSI
Date: Thu, 28 Apr 2022 15:06:53 +0000 [thread overview]
Message-ID: <20220428150653.xqpigo5cvy7k4zek@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <20220428145824.kp4p5qacgnncsxls@liuwe-devbox-debian-v2>
On Thu, Apr 28, 2022 at 02:58:24PM +0000, Wei Liu wrote:
> On Wed, Apr 27, 2022 at 08:07:33AM -0600, Jeffrey Hugo wrote:
> > In the multi-MSI case, hv_arch_irq_unmask() will only operate on the first
> > MSI of the N allocated. This is because only the first msi_desc is cached
> > and it is shared by all the MSIs of the multi-MSI block. This means that
> > hv_arch_irq_unmask() gets the correct address, but the wrong data (always
> > 0).
> >
> > This can break MSIs.
> >
> > Lets assume MSI0 is vector 34 on CPU0, and MSI1 is vector 33 on CPU0.
> >
> > hv_arch_irq_unmask() is called on MSI0. It uses a hypercall to configure
> > the MSI address and data (0) to vector 34 of CPU0. This is correct. Then
> > hv_arch_irq_unmask is called on MSI1. It uses another hypercall to
> > configure the MSI address and data (0) to vector 33 of CPU0. This is
> > wrong, and results in both MSI0 and MSI1 being routed to vector 33. Linux
> > will observe extra instances of MSI1 and no instances of MSI0 despite the
> > endpoint device behaving correctly.
> >
> > For the multi-MSI case, we need unique address and data info for each MSI,
> > but the cached msi_desc does not provide that. However, that information
> > can be gotten from the int_desc cached in the chip_data by
> > compose_msi_msg(). Fix the multi-MSI case to use that cached information
> > instead. Since hv_set_msi_entry_from_desc() is no longer applicable,
> > remove it.
> >
> > Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> > ---
> > drivers/pci/controller/pci-hyperv.c | 12 ++++--------
> > 1 file changed, 4 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> > index 5800ecf..7aea0b7 100644
> > --- a/drivers/pci/controller/pci-hyperv.c
> > +++ b/drivers/pci/controller/pci-hyperv.c
> > @@ -611,13 +611,6 @@ static unsigned int hv_msi_get_int_vector(struct irq_data *data)
> > return cfg->vector;
> > }
> >
> > -static void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry,
> > - struct msi_desc *msi_desc)
> > -{
> > - msi_entry->address.as_uint32 = msi_desc->msg.address_lo;
> > - msi_entry->data.as_uint32 = msi_desc->msg.data;
> > -}
> > -
>
> Instead of dropping this function, can you change the second argument to
> take struct tran_int_desc *?
>
> This way you can use the same function in hv_compose_msi_msg.
>
Never mind. I think I mixed things up. Sorry for the noise.
prev parent reply other threads:[~2022-04-28 15:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 14:07 [PATCH] PCI: hv: Fix hv_arch_irq_unmask() for multi-MSI Jeffrey Hugo
2022-04-27 17:11 ` Michael Kelley (LINUX)
2022-04-28 15:09 ` Wei Liu
2022-04-28 14:58 ` Wei Liu
2022-04-28 15:06 ` Jeffrey Hugo
2022-04-28 15:08 ` Wei Liu
2022-04-28 15:15 ` Jeffrey Hugo
2022-04-28 15:06 ` Wei Liu [this message]
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=20220428150653.xqpigo5cvy7k4zek@liuwe-devbox-debian-v2 \
--to=wei.liu@kernel.org \
--cc=bhelgaas@google.com \
--cc=bjorn.andersson@linaro.org \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kw@linux.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=quic_jhugo@quicinc.com \
--cc=robh@kernel.org \
--cc=sthemmin@microsoft.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;
as well as URLs for NNTP newsgroup(s).