[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c4ce4f00-eaf6-51ef-4b97-89ef37a6dd38@infradead.org>
Date: Mon, 8 Jul 2019 17:38:23 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Haiyang Zhang <haiyangz@...rosoft.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-pci <linux-pci@...r.kernel.org>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Matthew Wilcox <willy@...radead.org>,
Jake Oshins <jakeo@...rosoft.com>,
KY Srinivasan <kys@...rosoft.com>,
Sasha Levin <sashal@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
Dexuan Cui <decui@...rosoft.com>,
Yuehaibing <yuehaibing@...wei.com>
Subject: Re: [PATCH v2] PCI: hv: fix pci-hyperv build when SYSFS not enabled
On 7/8/19 8:05 AM, Stephen Hemminger wrote:
> On Sun, 7 Jul 2019 10:46:22 -0700
> Randy Dunlap <rdunlap@...radead.org> wrote:
>
>> On 7/3/19 11:06 AM, Haiyang Zhang wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Randy Dunlap <rdunlap@...radead.org>
>>>> Sent: Wednesday, July 3, 2019 12:59 PM
>>>> To: LKML <linux-kernel@...r.kernel.org>; linux-pci <linux-
>>>> pci@...r.kernel.org>
>>>> Cc: Matthew Wilcox <willy@...radead.org>; Jake Oshins
>>>> <jakeo@...rosoft.com>; KY Srinivasan <kys@...rosoft.com>; Haiyang
>>>> Zhang <haiyangz@...rosoft.com>; Stephen Hemminger
>>>> <sthemmin@...rosoft.com>; Sasha Levin <sashal@...nel.org>; Bjorn
>>>> Helgaas <bhelgaas@...gle.com>; linux-hyperv@...r.kernel.org; Dexuan
>>>> Cui <decui@...rosoft.com>; Yuehaibing <yuehaibing@...wei.com>
>>>> Subject: [PATCH v2] PCI: hv: fix pci-hyperv build when SYSFS not enabled
>>>>
>>>> From: Randy Dunlap <rdunlap@...radead.org>
>>>>
>>>> Fix build of drivers/pci/controller/pci-hyperv.o when
>>>> CONFIG_SYSFS is not set/enabled by adding stubs for
>>>> pci_create_slot() and pci_destroy_slot().
>>>>
>>>> Fixes these build errors:
>>>>
>>>> ERROR: "pci_destroy_slot" [drivers/pci/controller/pci-hyperv.ko] undefined!
>>>> ERROR: "pci_create_slot" [drivers/pci/controller/pci-hyperv.ko] undefined!
>>>>
>>>> Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot
>>>> information")
>>>>
>>>> Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
>>>> Cc: Matthew Wilcox <willy@...radead.org>
>>>> Cc: Jake Oshins <jakeo@...rosoft.com>
>>>> Cc: "K. Y. Srinivasan" <kys@...rosoft.com>
>>>> Cc: Haiyang Zhang <haiyangz@...rosoft.com>
>>>> Cc: Stephen Hemminger <sthemmin@...rosoft.com>
>>>> Cc: Sasha Levin <sashal@...nel.org>
>>>> Cc: Bjorn Helgaas <bhelgaas@...gle.com>
>>>> Cc: linux-pci@...r.kernel.org
>>>> Cc: linux-hyperv@...r.kernel.org
>>>> Cc: Dexuan Cui <decui@...rosoft.com>
>>>> Cc: Yuehaibing <yuehaibing@...wei.com>
>>>> ---
>>>> v2:
>>>> - provide non-CONFIG_SYSFS stubs for pci_create_slot() and
>>>> pci_destroy_slot() [suggested by Matthew Wilcox <willy@...radead.org>]
>>>> - use the correct Fixes: tag [Dexuan Cui <decui@...rosoft.com>]
>>>>
>>>> include/linux/pci.h | 12 ++++++++++--
>>>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>>>
>>>> --- lnx-52-rc7.orig/include/linux/pci.h
>>>> +++ lnx-52-rc7/include/linux/pci.h
>>>> @@ -25,6 +25,7 @@
>>>> #include <linux/ioport.h>
>>>> #include <linux/list.h>
>>>> #include <linux/compiler.h>
>>>> +#include <linux/err.h>
>>>> #include <linux/errno.h>
>>>> #include <linux/kobject.h>
>>>> #include <linux/atomic.h>
>>>> @@ -947,14 +948,21 @@ int pci_scan_root_bus_bridge(struct pci_
>>>> struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev
>>>> *dev,
>>>> int busnr);
>>>> void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
>>>> +#ifdef CONFIG_SYSFS
>>>> +void pci_dev_assign_slot(struct pci_dev *dev);
>>>> struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
>>>> const char *name,
>>>> struct hotplug_slot *hotplug);
>>>> void pci_destroy_slot(struct pci_slot *slot);
>>>> -#ifdef CONFIG_SYSFS
>>>> -void pci_dev_assign_slot(struct pci_dev *dev);
>>>> #else
>>>> static inline void pci_dev_assign_slot(struct pci_dev *dev) { }
>>>> +static inline struct pci_slot *pci_create_slot(struct pci_bus *parent,
>>>> + int slot_nr,
>>>> + const char *name,
>>>> + struct hotplug_slot *hotplug) {
>>>> + return ERR_PTR(-EINVAL);
>>>> +}
>>>> +static inline void pci_destroy_slot(struct pci_slot *slot) { }
>>>> #endif
>>>> int pci_scan_slot(struct pci_bus *bus, int devfn);
>>>> struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
>>>>
>>>
>>> The serial number in slot info is used to match VF NIC with Synthetic NIC.
>>> Without selecting SYSFS, the SRIOV feature will fail on VM on Hyper-V and
>>> Azure. The first version of this patch should be used.
>>>
>>> @Stephen Hemminger how do you think?
>
> Haiyang is right, accelerated networking won't work if slot is not recorded.
>
> So the original patch (to depend on SYSFS) or using "select SYSFS" is
> are necessary.
Thanks, I'll resend that one with the corrected Fixes: tag.
> The whole thing is a bit of "angels dancing on the head of a pin" because
> there is no good reason to build kernel without SYSFS in real world.
> It would just be looking for trouble. As far as I can tell it is all
> about getting "make randconfig" to work in more cases.
You could submit a patch to remove the SYSFS kconfig entry. :)
cheers.
--
~Randy
Powered by blists - more mailing lists