From: Thomas Gleixner <tglx@linutronix.de>
To: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Cc: Stanislav Kinsburskii <stanislav.kinsburskii@gmail.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] x86/hyperv: Expose an helper to map PCI interrupts
Date: Thu, 13 Apr 2023 15:51:09 +0200 [thread overview]
Message-ID: <87o7nrzy9e.ffs@tglx> (raw)
In-Reply-To: <168079870998.14175.16015623662679754647.stgit@skinsburskii.localdomain>
On Thu, Apr 06 2023 at 09:33, Stanislav Kinsburskii wrote:
> This patch moves
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#submittingpatches
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#changelog
> a part of currently internal logic into the new
> hv_map_msi_interrupt function and makes it globally available helper,
> which will be used to map PCI interrupts in case of root partition.
> -static int hv_map_msi_interrupt(struct pci_dev *dev, int cpu, int vector,
> - struct hv_interrupt_entry *entry)
> +/**
> + * hv_map_msi_interrupt() - "Map" the MSI IRQ in the hypervisor.
So if you need to put "" on Map then maybe your function is
misnomed. Either it maps or it does not, right?
> + * @data: Describes the IRQ
> + * @out_entry: Hypervisor (MSI) interrupt entry (can be NULL)
> + *
> + * Map the IRQ in the hypervisor by issuing a MAP_DEVICE_INTERRUPT hypercall.
> + */
> +int hv_map_msi_interrupt(struct irq_data *data,
> + struct hv_interrupt_entry *out_entry)
> {
> - union hv_device_id device_id = hv_build_pci_dev_id(dev);
> + struct msi_desc *msidesc;
> + struct pci_dev *dev;
> + union hv_device_id device_id;
> + struct hv_interrupt_entry dummy, *entry;
> + struct irq_cfg *cfg = irqd_cfg(data);
> + const cpumask_t *affinity;
> + int cpu, vector;
> +
> + msidesc = irq_data_get_msi_desc(data);
> + dev = msi_desc_to_pci_dev(msidesc);
> + device_id = hv_build_pci_dev_id(dev);
> + affinity = irq_data_get_effective_affinity_mask(data);
> + cpu = cpumask_first_and(affinity, cpu_online_mask);
The effective affinity mask of MSI interrupts consists only of online
CPUs, to be accurate: it has exactly one online CPU set.
But even if it would have only offline CPUs then the result would be:
cpu = nr_cpu_ids
which is definitely invalid. While a disabled vector targeted to an
offline CPU is not necessarily invalid.
Thanks,
tglx
next prev parent reply other threads:[~2023-04-13 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-06 16:31 [PATCH 0/2] Fix MSI interrupts for nested Hyper-V root partition Stanislav Kinsburskii
2023-04-06 16:33 ` [PATCH 1/2] x86/hyperv: Expose an helper to map PCI interrupts Stanislav Kinsburskii
2023-04-13 13:51 ` Thomas Gleixner [this message]
2023-04-12 16:19 ` Stanislav Kinsburskii
2023-04-12 16:36 ` Stanislav Kinsburskii
2023-04-14 7:28 ` Thomas Gleixner
2023-04-12 20:31 ` Stanislav Kinsburskii
2023-04-06 16:33 ` [PATCH 2/2] PCI: hv: Deal with nested MSHV setup Stanislav Kinsburskii
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=87o7nrzy9e.ffs@tglx \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=skinsburskii@linux.microsoft.com \
--cc=stanislav.kinsburskii@gmail.com \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
/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).