lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 27 Oct 2022 16:22:53 +0000
From:   Dexuan Cui <decui@...rosoft.com>
To:     "Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
        "quic_jhugo@...cinc.com" <quic_jhugo@...cinc.com>,
        "quic_carlv@...cinc.com" <quic_carlv@...cinc.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "lpieralisi@...nel.org" <lpieralisi@...nel.org>,
        "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "robh@...nel.org" <robh@...nel.org>, "kw@...ux.com" <kw@...ux.com>,
        "helgaas@...nel.org" <helgaas@...nel.org>,
        "alex.williamson@...hat.com" <alex.williamson@...hat.com>,
        "boqun.feng@...il.com" <boqun.feng@...il.com>,
        Boqun Feng <Boqun.Feng@...rosoft.com>
Subject: RE: [PATCH v2] PCI: hv: Only reuse existing IRTE allocation for
 Multi-MSI

> From: Michael Kelley (LINUX) <mikelley@...rosoft.com>
> Sent: Tuesday, October 25, 2022 11:18 AM
> > ...
> > -static u32 hv_compose_msi_req_v2(
> > -	struct pci_create_interrupt2 *int_pkt, const struct cpumask *affinity,
> > -	u32 slot, u8 vector, u8 vector_count)
> > +/*
> > + * Make sure the dummy vCPU values for multi-MSI don't all point to vCPU0.
> > + */
> > +static int hv_compose_multi_msi_req_get_cpu(void)
> >  {
> > +	static DEFINE_SPINLOCK(multi_msi_cpu_lock);
> > +
> > +	/* -1 means starting with CPU 0 */
> > +	static int cpu_next = -1;
> > +
> > +	unsigned long flags;
> >  	int cpu;
> >
> > +	spin_lock_irqsave(&multi_msi_cpu_lock, flags);
> > +
> > +	cpu_next = cpumask_next_wrap(cpu_next, cpu_online_mask,
> nr_cpu_ids,
> > +				     false);
> 
> I have a modest concern about using cpu_online_mask.  The CPUs in this
> mask
> can change if a CPU is taken online or offline in Linux. I don't think there's
> a requirement to pick on an online CPU, especially since if we pick a CPU that's
> online now, it might not be online later.  Using cpu_present_mask would be
> more correct.  That's the CPUs that are present in the VM, which won't
> change
> over time since Hyper-V doesn't hot-add or hot-remove CPUs in a VM.
> 
> A similar concern applies to hv_compose_msi_req_get_cpu().
> 
> Michael

Here cpu_online_mask is better than cpu_present_mask.
It doesn't matter an online target CPU becomes offline later, because when
the CPU is brought offline, the kernel should automatically migrate the
interrupt to a different online CPU.

hv_compose_multi_msi_req_get_cpu() is called when a PCI devic driver's
.probe() function is called, and the .probe() is called from the context
of pci_call_probe(), where CPU hotplug is temporarily disabled/enabled, so
here cpu_online_mask should not be an issue.

Thanks,
Dexuan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ