Message ID | 20210422195405.4053917-1-ndesaulniers@google.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | powerpc/powernv/pci: remove dead code from !CONFIG_EEH | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (d20f726744a0312b4b6613333bda7da9bc52fb75) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 19 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Hi Nick, > While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a > possible candidate to convert to #ifdef CONFIG_EEH, but it seems that > based on Kconfig dependencies it's not possible to build this file > without CONFIG_EEH enabled. This seemed odd to me, but I think you're right: arch/powerpc/platforms/Kconfig contains: config EEH bool depends on (PPC_POWERNV || PPC_PSERIES) && PCI default y It's not configurable from e.g. make menuconfig because there's no prompt. You can attempt to explicitly disable it with e.g. `scripts/config -d EEH` but then something like `make oldconfig` will silently re-enable it for you. It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") in 2012 which fixed it for pseries. That moved out from pseries to pseries + powernv later on. There are other cleanups in the same vein that could be made, from the Makefile (which has files only built with CONFIG_EEH) through to other source files. It looks like there's one `#ifdef CONFIG_EEH` in arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for example. I think it's probably worth trying to rip out all of those in one patch? Kind regards, Daniel
On Fri, Apr 23, 2021 at 9:09 AM Daniel Axtens <dja@axtens.net> wrote: > > Hi Nick, > > > While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a > > possible candidate to convert to #ifdef CONFIG_EEH, but it seems that > > based on Kconfig dependencies it's not possible to build this file > > without CONFIG_EEH enabled. > > This seemed odd to me, but I think you're right: > > arch/powerpc/platforms/Kconfig contains: > > config EEH > bool > depends on (PPC_POWERNV || PPC_PSERIES) && PCI > default y > > It's not configurable from e.g. make menuconfig because there's no prompt. > You can attempt to explicitly disable it with e.g. `scripts/config -d EEH` > but then something like `make oldconfig` will silently re-enable it for > you. > > It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet > CONFIG_EEH for pSeries platform") in 2012 which fixed it for > pseries. That moved out from pseries to pseries + powernv later on. > > There are other cleanups in the same vein that could be made, from the > Makefile (which has files only built with CONFIG_EEH) through to other > source files. It looks like there's one `#ifdef CONFIG_EEH` in > arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for > example. > > I think it's probably worth trying to rip out all of those in one patch? The change in commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") never should have been made. There's no inherent reason why EEH needs to be enabled and forcing it on is (IMO) a large part of why EEH support is the byzantine clusterfuck that it is. One of the things I was working towards was allowing pseries and powernv to be built with !CONFIG_EEH since that would help define a clearer boundary between what is "eeh support" and what is required to support PCI on the platform. Pseries is particularly bad for this since PAPR says the RTAS calls needed to do a PCI bus reset are part of the EEH extension, but there's non-EEH reasons why you might want to use those RTAS calls. The PHB reset that we do when entering a kdump kernel is a good example since that uses the same RTAS calls, but it has nothing to do with the EEH recovery machinery enabled by CONFIG_EEH. I was looking into that largely because people were considering using OPAL for microwatt platforms. Breaking the assumption that powernv==EEH support is one of the few bits of work required to enable that, but even if you don't go down that road I think everyone would be better off if you kept a degree of separation between the two.
On Thu, Apr 22, 2021 at 6:13 PM Oliver O'Halloran <oohall@gmail.com> wrote: > > On Fri, Apr 23, 2021 at 9:09 AM Daniel Axtens <dja@axtens.net> wrote: > > > > Hi Nick, > > > > > While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a > > > possible candidate to convert to #ifdef CONFIG_EEH, but it seems that > > > based on Kconfig dependencies it's not possible to build this file > > > without CONFIG_EEH enabled. > > > > This seemed odd to me, but I think you're right: > > > > arch/powerpc/platforms/Kconfig contains: > > > > config EEH > > bool > > depends on (PPC_POWERNV || PPC_PSERIES) && PCI > > default y > > > > It's not configurable from e.g. make menuconfig because there's no prompt. > > You can attempt to explicitly disable it with e.g. `scripts/config -d EEH` > > but then something like `make oldconfig` will silently re-enable it for > > you. > > > > It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet > > CONFIG_EEH for pSeries platform") in 2012 which fixed it for > > pseries. That moved out from pseries to pseries + powernv later on. > > > > There are other cleanups in the same vein that could be made, from the > > Makefile (which has files only built with CONFIG_EEH) through to other > > source files. It looks like there's one `#ifdef CONFIG_EEH` in > > arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for > > example. > > > > I think it's probably worth trying to rip out all of those in one patch? > > The change in commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH > for pSeries platform") never should have been made. I'll change my patch to keep the conditionals, but use #ifdef instead of #if then? > > There's no inherent reason why EEH needs to be enabled and forcing it > on is (IMO) a large part of why EEH support is the byzantine > clusterfuck that it is. One of the things I was working towards was > allowing pseries and powernv to be built with !CONFIG_EEH since that > would help define a clearer boundary between what is "eeh support" and > what is required to support PCI on the platform. Pseries is > particularly bad for this since PAPR says the RTAS calls needed to do > a PCI bus reset are part of the EEH extension, but there's non-EEH > reasons why you might want to use those RTAS calls. The PHB reset that > we do when entering a kdump kernel is a good example since that uses > the same RTAS calls, but it has nothing to do with the EEH recovery > machinery enabled by CONFIG_EEH. > > I was looking into that largely because people were considering using > OPAL for microwatt platforms. Breaking the assumption that > powernv==EEH support is one of the few bits of work required to enable > that, but even if you don't go down that road I think everyone would > be better off if you kept a degree of separation between the two.
Nick Desaulniers <ndesaulniers@google.com> writes: > On Thu, Apr 22, 2021 at 6:13 PM Oliver O'Halloran <oohall@gmail.com> wrote: >> >> On Fri, Apr 23, 2021 at 9:09 AM Daniel Axtens <dja@axtens.net> wrote: >> > >> > Hi Nick, >> > >> > > While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a >> > > possible candidate to convert to #ifdef CONFIG_EEH, but it seems that >> > > based on Kconfig dependencies it's not possible to build this file >> > > without CONFIG_EEH enabled. >> > >> > This seemed odd to me, but I think you're right: >> > >> > arch/powerpc/platforms/Kconfig contains: >> > >> > config EEH >> > bool >> > depends on (PPC_POWERNV || PPC_PSERIES) && PCI >> > default y >> > >> > It's not configurable from e.g. make menuconfig because there's no prompt. >> > You can attempt to explicitly disable it with e.g. `scripts/config -d EEH` >> > but then something like `make oldconfig` will silently re-enable it for >> > you. >> > >> > It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet >> > CONFIG_EEH for pSeries platform") in 2012 which fixed it for >> > pseries. That moved out from pseries to pseries + powernv later on. >> > >> > There are other cleanups in the same vein that could be made, from the >> > Makefile (which has files only built with CONFIG_EEH) through to other >> > source files. It looks like there's one `#ifdef CONFIG_EEH` in >> > arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for >> > example. >> > >> > I think it's probably worth trying to rip out all of those in one patch? >> >> The change in commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH >> for pSeries platform") never should have been made. > > I'll change my patch to keep the conditionals, but use #ifdef instead > of #if then? Yeah, please. I'm not sure I agree with oohal that untangling pseries/powernv from EEH is something we should do, but let's kick that can down the road by just fixing up the ifdef. cheers
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 9b9bca169275..591480a37b05 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c @@ -711,7 +711,6 @@ int pnv_pci_cfg_write(struct pci_dn *pdn, return PCIBIOS_SUCCESSFUL; } -#if CONFIG_EEH static bool pnv_pci_cfg_check(struct pci_dn *pdn) { struct eeh_dev *edev = NULL; @@ -734,12 +733,6 @@ static bool pnv_pci_cfg_check(struct pci_dn *pdn) return true; } -#else -static inline pnv_pci_cfg_check(struct pci_dn *pdn) -{ - return true; -} -#endif /* CONFIG_EEH */ static int pnv_pci_read_config(struct pci_bus *bus, unsigned int devfn,
While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled. Suggested-by: Nathan Chancellor <nathan@kernel.org> Suggested-by: Joe Perches <joe@perches.com> Link: https://github.com/ClangBuiltLinux/linux/issues/570 Link: https://lore.kernel.org/lkml/67f6cd269684c9aa8463ff4812c3b4605e6739c3.camel@perches.com/ Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> --- arch/powerpc/platforms/powernv/pci.c | 7 ------- 1 file changed, 7 deletions(-) base-commit: 16fc44d6387e260f4932e9248b985837324705d8 prerequisite-patch-id: 950233069fb22099a8ff8990f620f5c3586a3cbd