All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c
@ 2021-09-17 13:20 kernel test robot
  2021-09-19 10:22   ` kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2021-09-17 13:20 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17025 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210916085206.2268-5-refactormyself@gmail.com>
References: <20210916085206.2268-5-refactormyself@gmail.com>
TO: "Saheed O. Bolarinwa" <refactormyself@gmail.com>

Hi "Saheed,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on helgaas-pci/next]
[also build test WARNING on v5.15-rc1 next-20210917]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
:::::: branch date: 27 hours ago
:::::: commit date: 27 hours ago
config: riscv-randconfig-c006-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/a2a494c1e1531309518be74ed2e406334b716fbe
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
        git checkout a2a494c1e1531309518be74ed2e406334b716fbe
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                              ^   ~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   Suppressed 15 warnings (8 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (7 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (7 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (7 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (7 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   18 warnings generated.
   drivers/regulator/mt6358-regulator.c:278:47: warning: The result of the right shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
           selector = (selector & info->desc.vsel_mask) >>
                                                        ^
   drivers/regulator/mt6358-regulator.c:271:6: note: Assuming 'ret' is equal to 0
           if (ret != 0) {
               ^~~~~~~~
   drivers/regulator/mt6358-regulator.c:271:2: note: Taking false branch
           if (ret != 0) {
           ^
   drivers/regulator/mt6358-regulator.c:278:47: note: The result of the right shift is undefined because the right operand is negative
           selector = (selector & info->desc.vsel_mask) >>
                                                        ^
   drivers/regulator/mt6358-regulator.c:302:38: warning: The result of the right shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
           ret = (regval & info->da_vsel_mask) >> (ffs(info->da_vsel_mask) - 1);
                                               ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/mt6358-regulator.c:295:6: note: Assuming 'ret' is equal to 0
           if (ret != 0) {
               ^~~~~~~~
   drivers/regulator/mt6358-regulator.c:295:2: note: Taking false branch
           if (ret != 0) {
           ^
   drivers/regulator/mt6358-regulator.c:302:38: note: The result of the right shift is undefined because the right operand is negative
           ret = (regval & info->da_vsel_mask) >> (ffs(info->da_vsel_mask) - 1);
                                               ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/mt6358-regulator.c:342:6: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           val <<= ffs(info->modeset_mask) - 1;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/mt6358-regulator.c:328:2: note: Control jumps to 'case 2:'  at line 332
           switch (mode) {
           ^
   drivers/regulator/mt6358-regulator.c:334:3: note:  Execution continues on line 339
                   break;
                   ^
   drivers/regulator/mt6358-regulator.c:339:2: note: Loop condition is false.  Exiting loop
           dev_dbg(&rdev->dev, "mt6358 buck set_mode %#x, %#x, %#x\n",
           ^
   include/linux/dev_printk.h:158:2: note: expanded from macro 'dev_dbg'
           dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/dev_printk.h:128:3: note: expanded from macro 'dev_printk'
                   dev_printk_index_emit(level, fmt);                      \
                   ^
   include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
           printk_index_subsys_emit("%s %s: ", level, fmt)
           ^
   include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
           __printk_index_emit(fmt, level, subsys_fmt_prefix)
           ^
   include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit'
   #define __printk_index_emit(...) do {} while (0)
                                    ^
   drivers/regulator/mt6358-regulator.c:342:6: note: Assigned value is garbage or undefined
           val <<= ffs(info->modeset_mask) - 1;
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/mt6358-regulator.c:360:40: warning: The result of the right shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
           switch ((regval & info->modeset_mask) >> (ffs(info->modeset_mask) - 1)) {
                                                 ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/mt6358-regulator.c:354:6: note: Assuming 'ret' is equal to 0
           if (ret != 0) {
               ^~~~~~~~
   drivers/regulator/mt6358-regulator.c:354:2: note: Taking false branch
           if (ret != 0) {
           ^
   drivers/regulator/mt6358-regulator.c:360:40: note: The result of the right shift is undefined because the right operand is negative
           switch ((regval & info->modeset_mask) >> (ffs(info->modeset_mask) - 1)) {
                                                 ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 14 warnings (7 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (6 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (6 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (6 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (6 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
>> drivers/pci/pcie/aspm.c:963:35: warning: Access to field 'aspm_support' results in a dereference of an undefined pointer value (loaded from variable 'link') [clang-analyzer-core.NullDereference]
                   dev->link_state->aspm_capable = link->aspm_support;
                                                   ^
   drivers/pci/pcie/aspm.c:1024:6: note: Assuming 'aspm_disabled' is 0
           if (aspm_disabled || !link)
               ^~~~~~~~~~~~~
   drivers/pci/pcie/aspm.c:1024:6: note: Left side of '||' is false
   drivers/pci/pcie/aspm.c:1024:23: note: Assuming 'link' is non-null
           if (aspm_disabled || !link)
                                ^~~~~
   drivers/pci/pcie/aspm.c:1024:2: note: Taking false branch
           if (aspm_disabled || !link)
           ^
   drivers/pci/pcie/aspm.c:1032:2: note: Calling 'pcie_update_aspm_capable'
           pcie_update_aspm_capable(root->link_state);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/pcie/aspm.c:960:2: note: 'link' declared without an initial value
           struct pcie_link_state *link;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/pcie/aspm.c:961:2: note: Assuming field 'self' is null
           BUG_ON(root->pdev->bus->parent->self);
           ^
   include/asm-generic/bug.h:65:36: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                      ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   drivers/pci/pcie/aspm.c:961:2: note: Taking false branch
           BUG_ON(root->pdev->bus->parent->self);
           ^
   include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                  ^
   drivers/pci/pcie/aspm.c:961:2: note: Loop condition is false.  Exiting loop
           BUG_ON(root->pdev->bus->parent->self);
           ^
   include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                             ^
   drivers/pci/pcie/aspm.c:962:2: note: Left side of '&&' is false
           list_for_each_entry(dev, &rootbus->devices, bus_list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/pci/pcie/aspm.c:962:2: note: Taking false branch
           list_for_each_entry(dev, &rootbus->devices, bus_list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/pci/pcie/aspm.c:962:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(dev, &rootbus->devices, bus_list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/pci/pcie/aspm.c:962:2: note: Loop condition is true.  Entering loop body
           list_for_each_entry(dev, &rootbus->devices, bus_list) {

vim +963 drivers/pci/pcie/aspm.c

7d715a6c1ae578 Shaohua Li          2008-02-25  954  
07d92760d2ee54 Kenji Kaneshige     2009-08-19  955  /* Recheck latencies and update aspm_capable for links under the root */
07d92760d2ee54 Kenji Kaneshige     2009-08-19  956  static void pcie_update_aspm_capable(struct pcie_link_state *root)
07d92760d2ee54 Kenji Kaneshige     2009-08-19  957  {
b73623c75c53fb Bolarinwa O. Saheed 2021-09-16  958  	struct pci_dev *dev;
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  959  	struct pci_bus *rootbus = root->pdev->bus;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  960  	struct pcie_link_state *link;
d98a968e12577a Bolarinwa O. Saheed 2021-09-16  961  	BUG_ON(root->pdev->bus->parent->self);
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  962  	list_for_each_entry(dev, &rootbus->devices, bus_list) {
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16 @963  		dev->link_state->aspm_capable = link->aspm_support;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  964  	}
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  965  
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  966  	list_for_each_entry(dev, &rootbus->devices, bus_list) {
07d92760d2ee54 Kenji Kaneshige     2009-08-19  967  		struct pci_dev *child;
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  968  		struct pci_bus *linkbus = dev->subordinate;
b73623c75c53fb Bolarinwa O. Saheed 2021-09-16  969  
07d92760d2ee54 Kenji Kaneshige     2009-08-19  970  		list_for_each_entry(child, &linkbus->devices, bus_list) {
62f87c0e31d646 Yijing Wang         2012-07-24  971  			if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
62f87c0e31d646 Yijing Wang         2012-07-24  972  			    (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
07d92760d2ee54 Kenji Kaneshige     2009-08-19  973  				continue;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  974  			pcie_aspm_check_latency(child);
07d92760d2ee54 Kenji Kaneshige     2009-08-19  975  		}
07d92760d2ee54 Kenji Kaneshige     2009-08-19  976  	}
07d92760d2ee54 Kenji Kaneshige     2009-08-19  977  }
07d92760d2ee54 Kenji Kaneshige     2009-08-19  978  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36236 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c
  2021-09-17 13:20 [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c kernel test robot
@ 2021-09-19 10:22   ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-09-19 10:22 UTC (permalink / raw)
  To: Saheed O. Bolarinwa; +Cc: llvm, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4272 bytes --]

Hi Saheed,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on helgaas-pci/next]
[also build test WARNING on v5.15-rc1 next-20210917]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
:::::: branch date: 27 hours ago
:::::: commit date: 27 hours ago
config: riscv-randconfig-c006-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # install riscv cross compiling tool for clang build
         # apt-get install binutils-riscv64-linux-gnu
         # https://github.com/0day-ci/linux/commit/a2a494c1e1531309518be74ed2e406334b716fbe
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
         git checkout a2a494c1e1531309518be74ed2e406334b716fbe
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)

 >> drivers/pci/pcie/aspm.c:963:35: warning: Access to field 'aspm_support' results in a dereference of an undefined pointer value (loaded from variable 'link') [clang-analyzer-core.NullDereference]
                    dev->link_state->aspm_capable = link->aspm_support;
                                                    ^

vim +963 drivers/pci/pcie/aspm.c

7d715a6c1ae578 Shaohua Li          2008-02-25  954
07d92760d2ee54 Kenji Kaneshige     2009-08-19  955  /* Recheck latencies and update aspm_capable for links under the root */
07d92760d2ee54 Kenji Kaneshige     2009-08-19  956  static void pcie_update_aspm_capable(struct pcie_link_state *root)
07d92760d2ee54 Kenji Kaneshige     2009-08-19  957  {
b73623c75c53fb Bolarinwa O. Saheed 2021-09-16  958  	struct pci_dev *dev;
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  959  	struct pci_bus *rootbus = root->pdev->bus;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  960  	struct pcie_link_state *link;
d98a968e12577a Bolarinwa O. Saheed 2021-09-16  961  	BUG_ON(root->pdev->bus->parent->self);
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  962  	list_for_each_entry(dev, &rootbus->devices, bus_list) {
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16 @963  		dev->link_state->aspm_capable = link->aspm_support;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  964  	}
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  965
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  966  	list_for_each_entry(dev, &rootbus->devices, bus_list) {
07d92760d2ee54 Kenji Kaneshige     2009-08-19  967  		struct pci_dev *child;
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  968  		struct pci_bus *linkbus = dev->subordinate;
b73623c75c53fb Bolarinwa O. Saheed 2021-09-16  969
07d92760d2ee54 Kenji Kaneshige     2009-08-19  970  		list_for_each_entry(child, &linkbus->devices, bus_list) {
62f87c0e31d646 Yijing Wang         2012-07-24  971  			if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
62f87c0e31d646 Yijing Wang         2012-07-24  972  			    (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
07d92760d2ee54 Kenji Kaneshige     2009-08-19  973  				continue;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  974  			pcie_aspm_check_latency(child);
07d92760d2ee54 Kenji Kaneshige     2009-08-19  975  		}
07d92760d2ee54 Kenji Kaneshige     2009-08-19  976  	}
07d92760d2ee54 Kenji Kaneshige     2009-08-19  977  }
07d92760d2ee54 Kenji Kaneshige     2009-08-19  978

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36236 bytes --]

[-- Attachment #3: Attached Message Part --]
[-- Type: text/plain, Size: 154 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c
@ 2021-09-19 10:22   ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-09-19 10:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4343 bytes --]

Hi Saheed,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on helgaas-pci/next]
[also build test WARNING on v5.15-rc1 next-20210917]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
:::::: branch date: 27 hours ago
:::::: commit date: 27 hours ago
config: riscv-randconfig-c006-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # install riscv cross compiling tool for clang build
         # apt-get install binutils-riscv64-linux-gnu
         # https://github.com/0day-ci/linux/commit/a2a494c1e1531309518be74ed2e406334b716fbe
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
         git checkout a2a494c1e1531309518be74ed2e406334b716fbe
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)

 >> drivers/pci/pcie/aspm.c:963:35: warning: Access to field 'aspm_support' results in a dereference of an undefined pointer value (loaded from variable 'link') [clang-analyzer-core.NullDereference]
                    dev->link_state->aspm_capable = link->aspm_support;
                                                    ^

vim +963 drivers/pci/pcie/aspm.c

7d715a6c1ae578 Shaohua Li          2008-02-25  954
07d92760d2ee54 Kenji Kaneshige     2009-08-19  955  /* Recheck latencies and update aspm_capable for links under the root */
07d92760d2ee54 Kenji Kaneshige     2009-08-19  956  static void pcie_update_aspm_capable(struct pcie_link_state *root)
07d92760d2ee54 Kenji Kaneshige     2009-08-19  957  {
b73623c75c53fb Bolarinwa O. Saheed 2021-09-16  958  	struct pci_dev *dev;
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  959  	struct pci_bus *rootbus = root->pdev->bus;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  960  	struct pcie_link_state *link;
d98a968e12577a Bolarinwa O. Saheed 2021-09-16  961  	BUG_ON(root->pdev->bus->parent->self);
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  962  	list_for_each_entry(dev, &rootbus->devices, bus_list) {
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16 @963  		dev->link_state->aspm_capable = link->aspm_support;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  964  	}
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  965
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  966  	list_for_each_entry(dev, &rootbus->devices, bus_list) {
07d92760d2ee54 Kenji Kaneshige     2009-08-19  967  		struct pci_dev *child;
a2a494c1e15313 Bolarinwa O. Saheed 2021-09-16  968  		struct pci_bus *linkbus = dev->subordinate;
b73623c75c53fb Bolarinwa O. Saheed 2021-09-16  969
07d92760d2ee54 Kenji Kaneshige     2009-08-19  970  		list_for_each_entry(child, &linkbus->devices, bus_list) {
62f87c0e31d646 Yijing Wang         2012-07-24  971  			if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
62f87c0e31d646 Yijing Wang         2012-07-24  972  			    (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
07d92760d2ee54 Kenji Kaneshige     2009-08-19  973  				continue;
07d92760d2ee54 Kenji Kaneshige     2009-08-19  974  			pcie_aspm_check_latency(child);
07d92760d2ee54 Kenji Kaneshige     2009-08-19  975  		}
07d92760d2ee54 Kenji Kaneshige     2009-08-19  976  	}
07d92760d2ee54 Kenji Kaneshige     2009-08-19  977  }
07d92760d2ee54 Kenji Kaneshige     2009-08-19  978

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36236 bytes --]

[-- Attachment #3: AttachedMessagePart.ksh --]
[-- Type: text/plain, Size: 154 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c
  2021-09-16  8:52 ` [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c Saheed O. Bolarinwa
@ 2021-09-16 19:05     ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-09-16 19:05 UTC (permalink / raw)
  To: Saheed O. Bolarinwa; +Cc: llvm, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3122 bytes --]

Hi "Saheed,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on helgaas-pci/next]
[also build test WARNING on v5.15-rc1 next-20210916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-buildonly-randconfig-r002-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/a2a494c1e1531309518be74ed2e406334b716fbe
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
        git checkout a2a494c1e1531309518be74ed2e406334b716fbe
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/pci/pcie/aspm.c:963:35: warning: variable 'link' is uninitialized when used here [-Wuninitialized]
                   dev->link_state->aspm_capable = link->aspm_support;
                                                   ^~~~
   drivers/pci/pcie/aspm.c:960:30: note: initialize the variable 'link' to silence this warning
           struct pcie_link_state *link;
                                       ^
                                        = NULL
   1 warning generated.


vim +/link +963 drivers/pci/pcie/aspm.c

   954	
   955	/* Recheck latencies and update aspm_capable for links under the root */
   956	static void pcie_update_aspm_capable(struct pcie_link_state *root)
   957	{
   958		struct pci_dev *dev;
   959		struct pci_bus *rootbus = root->pdev->bus;
   960		struct pcie_link_state *link;
   961		BUG_ON(root->pdev->bus->parent->self);
   962		list_for_each_entry(dev, &rootbus->devices, bus_list) {
 > 963			dev->link_state->aspm_capable = link->aspm_support;
   964		}
   965	
   966		list_for_each_entry(dev, &rootbus->devices, bus_list) {
   967			struct pci_dev *child;
   968			struct pci_bus *linkbus = dev->subordinate;
   969	
   970			list_for_each_entry(child, &linkbus->devices, bus_list) {
   971				if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
   972				    (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
   973					continue;
   974				pcie_aspm_check_latency(child);
   975			}
   976		}
   977	}
   978	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 44159 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c
@ 2021-09-16 19:05     ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-09-16 19:05 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3193 bytes --]

Hi "Saheed,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on helgaas-pci/next]
[also build test WARNING on v5.15-rc1 next-20210916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-buildonly-randconfig-r002-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/a2a494c1e1531309518be74ed2e406334b716fbe
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Saheed-O-Bolarinwa/PCI-ASPM-Remove-struct-pcie_link_state-parent/20210916-175210
        git checkout a2a494c1e1531309518be74ed2e406334b716fbe
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/pci/pcie/aspm.c:963:35: warning: variable 'link' is uninitialized when used here [-Wuninitialized]
                   dev->link_state->aspm_capable = link->aspm_support;
                                                   ^~~~
   drivers/pci/pcie/aspm.c:960:30: note: initialize the variable 'link' to silence this warning
           struct pcie_link_state *link;
                                       ^
                                        = NULL
   1 warning generated.


vim +/link +963 drivers/pci/pcie/aspm.c

   954	
   955	/* Recheck latencies and update aspm_capable for links under the root */
   956	static void pcie_update_aspm_capable(struct pcie_link_state *root)
   957	{
   958		struct pci_dev *dev;
   959		struct pci_bus *rootbus = root->pdev->bus;
   960		struct pcie_link_state *link;
   961		BUG_ON(root->pdev->bus->parent->self);
   962		list_for_each_entry(dev, &rootbus->devices, bus_list) {
 > 963			dev->link_state->aspm_capable = link->aspm_support;
   964		}
   965	
   966		list_for_each_entry(dev, &rootbus->devices, bus_list) {
   967			struct pci_dev *child;
   968			struct pci_bus *linkbus = dev->subordinate;
   969	
   970			list_for_each_entry(child, &linkbus->devices, bus_list) {
   971				if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
   972				    (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
   973					continue;
   974				pcie_aspm_check_latency(child);
   975			}
   976		}
   977	}
   978	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 44159 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c
  2021-09-16  8:52 [RFC PATCH 0/3] PCI/ASPM: Remove unncessary linked list in aspm.c Saheed O. Bolarinwa
@ 2021-09-16  8:52 ` Saheed O. Bolarinwa
  2021-09-16 19:05     ` kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: Saheed O. Bolarinwa @ 2021-09-16  8:52 UTC (permalink / raw)
  To: helgaas; +Cc: Bolarinwa O. Saheed, linux-pci, linux-kernel, kw

From: "Bolarinwa O. Saheed" <refactormyself@gmail.com>

aspm.c defines a linked list - `link_list` and stores each of
its node in struct pcie_link_state.sibling. This linked list
tracks devices for which the struct pcie_link_state object
was successfully created. It is used to loop through the list
for instance to set ASPM policy or update changes. However, it
is possible to access these devices via existing lists defined
inside pci.h

This patch:
- removes link_list and struct pcie_link_state.sibling
- accesses child devices via struct pci_dev.bust_list
- accesses all PCI buses via pci_root_buses on struct pci_bus.node

Signed-off-by: Bolarinwa O. Saheed <refactormyself@gmail.com>
---
 drivers/pci/pcie/aspm.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 516a6f07ac6e..35bc16c00b32 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -48,7 +48,6 @@ struct aspm_latency {
 
 struct pcie_link_state {
 	struct pci_dev *pdev;		/* Upstream component of the Link */
-	struct list_head sibling;	/* node in link_list */
 
 	/* ASPM state */
 	u32 aspm_support:7;		/* Supported ASPM state */
@@ -76,7 +75,6 @@ struct pcie_link_state {
 static int aspm_disabled, aspm_force;
 static bool aspm_support_enabled = true;
 static DEFINE_MUTEX(aspm_lock);
-static LIST_HEAD(link_list);
 
 #define POLICY_DEFAULT 0	/* BIOS default setting */
 #define POLICY_PERFORMANCE 1	/* high performance */
@@ -872,10 +870,7 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
 	if (!link)
 		return NULL;
 
-	INIT_LIST_HEAD(&link->sibling);
 	link->pdev = pdev;
-
-	list_add(&link->sibling, &link_list);
 	pdev->link_state = link;
 	return link;
 }
@@ -961,21 +956,16 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
 static void pcie_update_aspm_capable(struct pcie_link_state *root)
 {
 	struct pci_dev *dev;
+	struct pci_bus *rootbus = root->pdev->bus;
 	struct pcie_link_state *link;
 	BUG_ON(root->pdev->bus->parent->self);
-	list_for_each_entry(link, &link_list, sibling) {
-		dev = pcie_get_root(link->pdev);
-		if (dev->link_state != root)
-			continue;
-
-		link->aspm_capable = link->aspm_support;
+	list_for_each_entry(dev, &rootbus->devices, bus_list) {
+		dev->link_state->aspm_capable = link->aspm_support;
 	}
-	list_for_each_entry(link, &link_list, sibling) {
+
+	list_for_each_entry(dev, &rootbus->devices, bus_list) {
 		struct pci_dev *child;
-		struct pci_bus *linkbus = link->pdev->subordinate;
-		dev = pcie_get_root(link->pdev);
-		if (dev->link_state != root)
-			continue;
+		struct pci_bus *linkbus = dev->subordinate;
 
 		list_for_each_entry(child, &linkbus->devices, bus_list) {
 			if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
@@ -1012,7 +1002,6 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
 
 	/* All functions are removed, so just disable ASPM for the link */
 	pcie_config_aspm_link(link, 0);
-	list_del(&link->sibling);
 	/* Clock PM is for endpoint device */
 	free_link_state(link);
 
@@ -1152,6 +1141,8 @@ static int pcie_aspm_set_policy(const char *val,
 {
 	int i;
 	struct pcie_link_state *link;
+	struct pci_bus *bus;
+	struct pci_dev *pdev;
 
 	if (aspm_disabled)
 		return -EPERM;
@@ -1164,9 +1155,18 @@ static int pcie_aspm_set_policy(const char *val,
 	down_read(&pci_bus_sem);
 	mutex_lock(&aspm_lock);
 	aspm_policy = i;
-	list_for_each_entry(link, &link_list, sibling) {
-		pcie_config_aspm_link(link, policy_to_aspm_state(link));
-		pcie_set_clkpm(link, policy_to_clkpm_state(link));
+	list_for_each_entry(bus, &pci_root_buses, node) {
+		list_for_each_entry(pdev, &bus->devices, bus_list) {
+			if (!pci_is_pcie(pdev))
+				break;
+
+			link = pdev->link_state;
+			if (!link)
+				continue;
+
+			pcie_config_aspm_link(link, policy_to_aspm_state(link));
+			pcie_set_clkpm(link, policy_to_clkpm_state(link));
+		}
 	}
 	mutex_unlock(&aspm_lock);
 	up_read(&pci_bus_sem);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-19 10:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 13:20 [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c kernel test robot
2021-09-19 10:22 ` kernel test robot
2021-09-19 10:22   ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-09-16  8:52 [RFC PATCH 0/3] PCI/ASPM: Remove unncessary linked list in aspm.c Saheed O. Bolarinwa
2021-09-16  8:52 ` [RFC PATCH 4/4] PCI/ASPM: Remove unncessary linked list defined within aspm.c Saheed O. Bolarinwa
2021-09-16 19:05   ` kernel test robot
2021-09-16 19:05     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.