All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] PCI/ASPM: Remove unncessary linked list in aspm.c
@ 2021-09-16  8:52 Saheed O. Bolarinwa
  2021-09-16  8:52 ` [RFC PATCH 1/4] PCI/ASPM: Remove struct pcie_link_state.parent Saheed O. Bolarinwa
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ 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>

An extra linked list is created inside aspm.c to keep track of devices
on which the link state was enabled. However, it is possible to access
them via existing device lists.

This series remove the extra linked list and other related members of
the struct pcie_link_state: `root`, `parent` and `downstream`. All these
are now either calculated or obtained directly when needed.

Bolarinwa O. Saheed (4):
  PCI/ASPM: Remove struct pcie_link_state.parent
  PCI/ASPM: Remove struct pcie_link_state.root
  PCI/ASPM: Remove struct pcie_link_state.downstream
  PCI/ASPM: Remove unncessary linked list defined within aspm.c

 drivers/pci/pcie/aspm.c | 121 +++++++++++++++++++++-------------------
 1 file changed, 64 insertions(+), 57 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* 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; 11+ 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] 11+ messages in thread

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 1/4] PCI/ASPM: Remove struct pcie_link_state.parent Saheed O. Bolarinwa
2021-09-26 22:05   ` Bjorn Helgaas
2021-09-16  8:52 ` [RFC PATCH 2/4] PCI/ASPM: Remove struct pcie_link_state.root Saheed O. Bolarinwa
2021-09-16  8:52 ` [RFC PATCH 3/4] PCI/ASPM: Remove struct pcie_link_state.downstream 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
2021-09-17 13:20 kernel test robot
2021-09-19 10:22 ` kernel test robot
2021-09-19 10:22   ` 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.