* [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
@ 2023-04-04 11:35 Jinank Jain
2023-04-04 17:00 ` Nuno Das Neves
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jinank Jain @ 2023-04-04 11:35 UTC (permalink / raw)
To: jinankjain, kys, haiyangz, wei.liu, decui, lpieralisi, kw, robh,
bhelgaas
Cc: linux-hyperv, linux-pci, linux-kernel, nunodasneves
In case of nested MSHV, retargeting interrupt hypercall should be sent
to L0 hypervisor instead of L1 hypervisor.
Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
---
drivers/pci/controller/pci-hyperv.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index f33370b75628..2123f632ecf7 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -704,8 +704,14 @@ static void hv_arch_irq_unmask(struct irq_data *data)
}
}
- res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17),
- params, NULL);
+ if (hv_nested)
+ res = hv_do_nested_hypercall(HVCALL_RETARGET_INTERRUPT |
+ (var_size << 17),
+ params, NULL);
+ else
+ res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT |
+ (var_size << 17),
+ params, NULL);
exit_unlock:
spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
2023-04-04 11:35 [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts Jinank Jain
@ 2023-04-04 17:00 ` Nuno Das Neves
2023-04-05 23:17 ` Wei Liu
2023-04-13 1:22 ` Wei Liu
2 siblings, 0 replies; 7+ messages in thread
From: Nuno Das Neves @ 2023-04-04 17:00 UTC (permalink / raw)
To: Jinank Jain, jinankjain, kys, haiyangz, wei.liu, decui,
lpieralisi, kw, robh, bhelgaas
Cc: linux-hyperv, linux-pci, linux-kernel
Reviewed-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
On 4/4/2023 4:35 AM, Jinank Jain wrote:
> In case of nested MSHV, retargeting interrupt hypercall should be sent
> to L0 hypervisor instead of L1 hypervisor.
>
> Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
> ---
> drivers/pci/controller/pci-hyperv.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index f33370b75628..2123f632ecf7 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -704,8 +704,14 @@ static void hv_arch_irq_unmask(struct irq_data *data)
> }
> }
>
> - res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17),
> - params, NULL);
> + if (hv_nested)
> + res = hv_do_nested_hypercall(HVCALL_RETARGET_INTERRUPT |
> + (var_size << 17),
> + params, NULL);
> + else
> + res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT |
> + (var_size << 17),
> + params, NULL);
>
> exit_unlock:
> spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
2023-04-04 11:35 [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts Jinank Jain
2023-04-04 17:00 ` Nuno Das Neves
@ 2023-04-05 23:17 ` Wei Liu
2023-04-06 6:11 ` Jinank Jain
2023-04-13 1:22 ` Wei Liu
2 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2023-04-05 23:17 UTC (permalink / raw)
To: Jinank Jain
Cc: jinankjain, kys, haiyangz, wei.liu, decui, lpieralisi, kw, robh,
bhelgaas, linux-hyperv, linux-pci, linux-kernel, nunodasneves
On Tue, Apr 04, 2023 at 11:35:46AM +0000, Jinank Jain wrote:
> In case of nested MSHV, retargeting interrupt hypercall should be sent
> to L0 hypervisor instead of L1 hypervisor.
>
> Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
While I think this is a sensible change -- how did you discover this?
Can you provide a bit more information?
> ---
> drivers/pci/controller/pci-hyperv.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index f33370b75628..2123f632ecf7 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -704,8 +704,14 @@ static void hv_arch_irq_unmask(struct irq_data *data)
> }
> }
>
> - res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17),
> - params, NULL);
> + if (hv_nested)
> + res = hv_do_nested_hypercall(HVCALL_RETARGET_INTERRUPT |
> + (var_size << 17),
> + params, NULL);
> + else
> + res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT |
> + (var_size << 17),
> + params, NULL);
>
> exit_unlock:
> spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
2023-04-05 23:17 ` Wei Liu
@ 2023-04-06 6:11 ` Jinank Jain
0 siblings, 0 replies; 7+ messages in thread
From: Jinank Jain @ 2023-04-06 6:11 UTC (permalink / raw)
To: Wei Liu
Cc: jinankjain, kys, haiyangz, decui, lpieralisi, kw, robh, bhelgaas,
linux-hyperv, linux-pci, linux-kernel, nunodasneves
This was observed while testing pass-through PCI devices on the nested
MSHV setup.
Regards,
Jinank
On 4/6/2023 4:47 AM, Wei Liu wrote:
> On Tue, Apr 04, 2023 at 11:35:46AM +0000, Jinank Jain wrote:
>> In case of nested MSHV, retargeting interrupt hypercall should be sent
>> to L0 hypervisor instead of L1 hypervisor.
>>
>> Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
> While I think this is a sensible change -- how did you discover this?
> Can you provide a bit more information?
>
>> ---
>> drivers/pci/controller/pci-hyperv.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
>> index f33370b75628..2123f632ecf7 100644
>> --- a/drivers/pci/controller/pci-hyperv.c
>> +++ b/drivers/pci/controller/pci-hyperv.c
>> @@ -704,8 +704,14 @@ static void hv_arch_irq_unmask(struct irq_data *data)
>> }
>> }
>>
>> - res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17),
>> - params, NULL);
>> + if (hv_nested)
>> + res = hv_do_nested_hypercall(HVCALL_RETARGET_INTERRUPT |
>> + (var_size << 17),
>> + params, NULL);
>> + else
>> + res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT |
>> + (var_size << 17),
>> + params, NULL);
>>
>> exit_unlock:
>> spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags);
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
2023-04-04 11:35 [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts Jinank Jain
2023-04-04 17:00 ` Nuno Das Neves
2023-04-05 23:17 ` Wei Liu
@ 2023-04-13 1:22 ` Wei Liu
2023-04-13 3:05 ` Michael Kelley (LINUX)
2 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2023-04-13 1:22 UTC (permalink / raw)
To: Jinank Jain, g
Cc: jinankjain, kys, haiyangz, wei.liu, decui, lpieralisi, kw, robh,
bhelgaas, linux-hyperv, linux-pci, linux-kernel, nunodasneves
On Tue, Apr 04, 2023 at 11:35:46AM +0000, Jinank Jain wrote:
> In case of nested MSHV, retargeting interrupt hypercall should be sent
> to L0 hypervisor instead of L1 hypervisor.
>
> Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
Applied to hyperv-next. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
2023-04-13 1:22 ` Wei Liu
@ 2023-04-13 3:05 ` Michael Kelley (LINUX)
2023-04-13 15:34 ` Wei Liu
0 siblings, 1 reply; 7+ messages in thread
From: Michael Kelley (LINUX) @ 2023-04-13 3:05 UTC (permalink / raw)
To: Wei Liu, Jinank Jain, g@liuwe-devbox-debian-v2
Cc: Jinank Jain, KY Srinivasan, Haiyang Zhang, Dexuan Cui,
lpieralisi@kernel.org, kw@linux.com, robh@kernel.org,
bhelgaas@google.com, linux-hyperv@vger.kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
nunodasneves@linux.microsoft.com
From: Wei Liu <wei.liu@kernel.org> Sent: Wednesday, April 12, 2023 6:23 PM
>
> On Tue, Apr 04, 2023 at 11:35:46AM +0000, Jinank Jain wrote:
> > In case of nested MSHV, retargeting interrupt hypercall should be sent
> > to L0 hypervisor instead of L1 hypervisor.
> >
> > Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
>
> Applied to hyperv-next. Thanks.
I'd like to hold off on taking this change. Nuno and I are discussing
how best to handle nested hypercalls. In addition to the proposed
nested changes, we have hypercall changes coming as part of the
TDX and fully enlightened SNP patch sets. If possible, I'd like to
avoid adding logic at the hv_do_hypercall() call sites. It's not clear
whether avoiding such logic will really be feasible, but I'd like to
think about it for a bit before reaching that conclusion.
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts
2023-04-13 3:05 ` Michael Kelley (LINUX)
@ 2023-04-13 15:34 ` Wei Liu
0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2023-04-13 15:34 UTC (permalink / raw)
To: Michael Kelley (LINUX)
Cc: Wei Liu, Jinank Jain, g@liuwe-devbox-debian-v2, Jinank Jain,
KY Srinivasan, Haiyang Zhang, Dexuan Cui, lpieralisi@kernel.org,
kw@linux.com, robh@kernel.org, bhelgaas@google.com,
linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, nunodasneves@linux.microsoft.com
On Thu, Apr 13, 2023 at 03:05:09AM +0000, Michael Kelley (LINUX) wrote:
> From: Wei Liu <wei.liu@kernel.org> Sent: Wednesday, April 12, 2023 6:23 PM
> >
> > On Tue, Apr 04, 2023 at 11:35:46AM +0000, Jinank Jain wrote:
> > > In case of nested MSHV, retargeting interrupt hypercall should be sent
> > > to L0 hypervisor instead of L1 hypervisor.
> > >
> > > Signed-off-by: Jinank Jain <jinankjain@linux.microsoft.com>
> >
> > Applied to hyperv-next. Thanks.
>
> I'd like to hold off on taking this change. Nuno and I are discussing
> how best to handle nested hypercalls. In addition to the proposed
> nested changes, we have hypercall changes coming as part of the
> TDX and fully enlightened SNP patch sets. If possible, I'd like to
> avoid adding logic at the hv_do_hypercall() call sites. It's not clear
> whether avoiding such logic will really be feasible, but I'd like to
> think about it for a bit before reaching that conclusion.
I thought that discussion will go on for a while but this patch fixed a
real bug.
Holding off is fine too. I will remove this patch from hyperv-next.
Thanks,
Wei.
>
> Michael
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-13 15:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-04 11:35 [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts Jinank Jain
2023-04-04 17:00 ` Nuno Das Neves
2023-04-05 23:17 ` Wei Liu
2023-04-06 6:11 ` Jinank Jain
2023-04-13 1:22 ` Wei Liu
2023-04-13 3:05 ` Michael Kelley (LINUX)
2023-04-13 15:34 ` Wei Liu
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).