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] [thread-next>] [day] [month] [year] [list]
Message-ID: <201902042322.W4WIZR8T%fengguang.wu@intel.com>
Date:   Mon, 4 Feb 2019 23:27:56 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Nicholas Johnson <nicholas.johnson-opensource@...look.com.au>
Cc:     kbuild-all@...org,
        "mika.westerberg@...ux.intel.com" <mika.westerberg@...ux.intel.com>,
        Nicholas Johnson <nicholas.johnson-opensource@...look.com.au>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PCI: Consider alignment of hot-added bridges when
 distributing available resources

Hi Nicholas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pci/next]
[also build test WARNING on v5.0-rc4 next-20190204]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Johnson/PCI-Consider-alignment-of-hot-added-bridges-when-distributing-available-resources/20190204-182638
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-randconfig-s0-02041749 (attached as .config)
compiler: gcc-6 (Debian 6.5.0-2) 6.5.0 20181026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/pci.h:31:0,
                    from drivers/pci/setup-bus.c:20:
   drivers/pci/setup-bus.c: In function 'extend_bridge_window':
   drivers/pci/setup-bus.c:1831:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
     pci_dbg(bridge, "bridge window %pR extended by 0x%016llx\n", res,
                     ^
   include/linux/device.h:1380:22: note: in definition of macro 'dev_fmt'
    #define dev_fmt(fmt) fmt
                         ^~~
>> include/linux/pci.h:2362:36: note: in expansion of macro 'dev_dbg'
    #define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg)
                                       ^~~~~~~
>> drivers/pci/setup-bus.c:1831:2: note: in expansion of macro 'pci_dbg'
     pci_dbg(bridge, "bridge window %pR extended by 0x%016llx\n", res,
     ^~~~~~~
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:__ffs
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 1 include/linux/list.h:list_empty
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
   Cyclomatic Complexity 1 include/linux/ioport.h:resource_size
   Cyclomatic Complexity 1 include/linux/ioport.h:resource_type
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc_type
   Cyclomatic Complexity 56 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 7 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/pci.h:pci_is_root_bus
   Cyclomatic Complexity 1 include/linux/pci.h:pci_is_bridge
   Cyclomatic Complexity 1 include/linux/pci.h:pci_is_enabled
   Cyclomatic Complexity 1 arch/x86/include/asm/pci.h:pci_domain_nr
   Cyclomatic Complexity 2 include/linux/acpi.h:acpi_device_handle
   Cyclomatic Complexity 1 drivers/pci/pci.h:pci_has_subordinate
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:reset_resource
   Cyclomatic Complexity 2 drivers/pci/setup-bus.c:pci_fail_res_type_mask
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pci_realloc_enabled
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pci_realloc_detect
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:pci_bridge_check_ranges
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:res_to_dev_res
   Cyclomatic Complexity 2 drivers/pci/setup-bus.c:get_res_add_size
   Cyclomatic Complexity 2 drivers/pci/setup-bus.c:get_res_add_align
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:calculate_iosize
   Cyclomatic Complexity 6 drivers/pci/setup-bus.c:calculate_mem_align
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:calculate_memsize
   Cyclomatic Complexity 17 drivers/pci/setup-bus.c:pci_need_to_release
   Cyclomatic Complexity 12 include/linux/ioport.h:resource_contains
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:pci_bus_get_depth
   Cyclomatic Complexity 5 drivers/pci/setup-bus.c:extend_bridge_window
   Cyclomatic Complexity 3 arch/x86/include/asm/div64.h:div_u64_rem
   Cyclomatic Complexity 1 include/linux/math64.h:div_u64
   Cyclomatic Complexity 3 drivers/pci/setup-bus.c:pci_setup_bridge_mmio
   Cyclomatic Complexity 5 drivers/pci/setup-bus.c:pci_setup_bridge_mmio_pref
   Cyclomatic Complexity 5 drivers/pci/setup-bus.c:pci_setup_bridge_io
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:__pci_setup_bridge
   Cyclomatic Complexity 10 drivers/pci/setup-bus.c:pci_claim_device_resources
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:pci_bus_allocate_dev_resources
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add
   Cyclomatic Complexity 3 drivers/pci/setup-bus.c:add_to_list
   Cyclomatic Complexity 23 drivers/pci/setup-bus.c:pci_bus_size_cardbus
   Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
   Cyclomatic Complexity 22 drivers/pci/setup-bus.c:find_free_bus_resource
   Cyclomatic Complexity 14 drivers/pci/setup-bus.c:pci_bus_dump_res
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:pci_bus_dump_resources
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_move_tail
   Cyclomatic Complexity 1 include/linux/list.h:list_del
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:remove_from_list
   Cyclomatic Complexity 2 drivers/pci/setup-bus.c:free_list
   Cyclomatic Complexity 15 drivers/pci/setup-bus.c:assign_requested_resources_sorted
   Cyclomatic Complexity 12 drivers/pci/setup-bus.c:reassign_resources_sorted
   Cyclomatic Complexity 8 drivers/pci/setup-bus.c:assign_fixed_resource_on_bus
   Cyclomatic Complexity 15 drivers/pci/setup-bus.c:pdev_assign_fixed_resources
   Cyclomatic Complexity 20 drivers/pci/setup-bus.c:pci_bridge_release_resources
   Cyclomatic Complexity 13 drivers/pci/setup-bus.c:pci_bus_release_bridge_resources
   Cyclomatic Complexity 9 drivers/pci/setup-bus.c:pci_setup_cardbus
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pcibios_setup_bridge
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pci_setup_bridge
   Cyclomatic Complexity 11 drivers/pci/setup-bus.c:pci_claim_bridge_resource
   Cyclomatic Complexity 10 drivers/pci/setup-bus.c:pci_claim_bridge_resources
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:pci_bus_allocate_resources
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pcibios_window_alignment
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:window_alignment
   Cyclomatic Complexity 5 drivers/pci/setup-bus.c:pci_cardbus_resource_alignment
   Cyclomatic Complexity 5 drivers/pci/pci.h:pci_resource_alignment
   Cyclomatic Complexity 34 drivers/pci/setup-bus.c:pbus_size_io
   Cyclomatic Complexity 55 drivers/pci/setup-bus.c:pbus_size_mem
   Cyclomatic Complexity 18 drivers/pci/setup-bus.c:pdev_sort_resources
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:__dev_sort_resources
   Cyclomatic Complexity 26 drivers/pci/setup-bus.c:__assign_resources_sorted
   Cyclomatic Complexity 2 drivers/pci/setup-bus.c:pbus_assign_resources_sorted
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pdev_assign_resources_sorted
   Cyclomatic Complexity 61 drivers/pci/setup-bus.c:pci_bus_distribute_available_resources
   Cyclomatic Complexity 3 drivers/pci/setup-bus.c:pci_bridge_distribute_available_resources
   Cyclomatic Complexity 22 drivers/pci/setup-bus.c:__pci_bus_size_bridges
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pci_bus_size_bridges
   Cyclomatic Complexity 7 drivers/pci/setup-bus.c:__pci_bus_assign_resources
   Cyclomatic Complexity 5 drivers/pci/setup-bus.c:__pci_bridge_assign_resources
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pci_bus_assign_resources
   Cyclomatic Complexity 1 drivers/pci/setup-bus.c:pci_bus_claim_resources
   Cyclomatic Complexity 3 drivers/pci/setup-bus.c:pci_realloc_get_opt
   Cyclomatic Complexity 19 drivers/pci/setup-bus.c:pci_assign_unassigned_root_bus_resources
   Cyclomatic Complexity 5 drivers/pci/setup-bus.c:pci_assign_unassigned_resources
   Cyclomatic Complexity 10 drivers/pci/setup-bus.c:pci_assign_unassigned_bridge_resources
   Cyclomatic Complexity 21 drivers/pci/setup-bus.c:pci_reassign_bridge_resources
   Cyclomatic Complexity 4 drivers/pci/setup-bus.c:pci_assign_unassigned_bus_resources
--
   In file included from include/linux/pci.h:31:0,
                    from drivers//pci/setup-bus.c:20:
   drivers//pci/setup-bus.c: In function 'extend_bridge_window':
   drivers//pci/setup-bus.c:1831:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
     pci_dbg(bridge, "bridge window %pR extended by 0x%016llx\n", res,
                     ^
   include/linux/device.h:1380:22: note: in definition of macro 'dev_fmt'
    #define dev_fmt(fmt) fmt
                         ^~~
>> include/linux/pci.h:2362:36: note: in expansion of macro 'dev_dbg'
    #define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg)
                                       ^~~~~~~
   drivers//pci/setup-bus.c:1831:2: note: in expansion of macro 'pci_dbg'
     pci_dbg(bridge, "bridge window %pR extended by 0x%016llx\n", res,
     ^~~~~~~
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:__ffs
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 1 include/linux/list.h:list_empty
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
   Cyclomatic Complexity 1 include/linux/ioport.h:resource_size
   Cyclomatic Complexity 1 include/linux/ioport.h:resource_type
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc_type
   Cyclomatic Complexity 56 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 7 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/pci.h:pci_is_root_bus
   Cyclomatic Complexity 1 include/linux/pci.h:pci_is_bridge
   Cyclomatic Complexity 1 include/linux/pci.h:pci_is_enabled
   Cyclomatic Complexity 1 arch/x86/include/asm/pci.h:pci_domain_nr
   Cyclomatic Complexity 2 include/linux/acpi.h:acpi_device_handle
   Cyclomatic Complexity 1 drivers//pci/pci.h:pci_has_subordinate
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:reset_resource
   Cyclomatic Complexity 2 drivers//pci/setup-bus.c:pci_fail_res_type_mask
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pci_realloc_enabled
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pci_realloc_detect
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:pci_bridge_check_ranges
   Cyclomatic Complexity 4 drivers//pci/setup-bus.c:res_to_dev_res
   Cyclomatic Complexity 2 drivers//pci/setup-bus.c:get_res_add_size
   Cyclomatic Complexity 2 drivers//pci/setup-bus.c:get_res_add_align
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:calculate_iosize
   Cyclomatic Complexity 6 drivers//pci/setup-bus.c:calculate_mem_align
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:calculate_memsize
   Cyclomatic Complexity 17 drivers//pci/setup-bus.c:pci_need_to_release
   Cyclomatic Complexity 12 include/linux/ioport.h:resource_contains
   Cyclomatic Complexity 4 drivers//pci/setup-bus.c:pci_bus_get_depth
   Cyclomatic Complexity 5 drivers//pci/setup-bus.c:extend_bridge_window
   Cyclomatic Complexity 3 arch/x86/include/asm/div64.h:div_u64_rem
   Cyclomatic Complexity 1 include/linux/math64.h:div_u64
   Cyclomatic Complexity 3 drivers//pci/setup-bus.c:pci_setup_bridge_mmio
   Cyclomatic Complexity 5 drivers//pci/setup-bus.c:pci_setup_bridge_mmio_pref
   Cyclomatic Complexity 5 drivers//pci/setup-bus.c:pci_setup_bridge_io
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:__pci_setup_bridge
   Cyclomatic Complexity 10 drivers//pci/setup-bus.c:pci_claim_device_resources
   Cyclomatic Complexity 4 drivers//pci/setup-bus.c:pci_bus_allocate_dev_resources
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add
   Cyclomatic Complexity 3 drivers//pci/setup-bus.c:add_to_list
   Cyclomatic Complexity 23 drivers//pci/setup-bus.c:pci_bus_size_cardbus
   Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
   Cyclomatic Complexity 22 drivers//pci/setup-bus.c:find_free_bus_resource
   Cyclomatic Complexity 14 drivers//pci/setup-bus.c:pci_bus_dump_res
   Cyclomatic Complexity 4 drivers//pci/setup-bus.c:pci_bus_dump_resources
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_move_tail
   Cyclomatic Complexity 1 include/linux/list.h:list_del
   Cyclomatic Complexity 4 drivers//pci/setup-bus.c:remove_from_list
   Cyclomatic Complexity 2 drivers//pci/setup-bus.c:free_list
   Cyclomatic Complexity 15 drivers//pci/setup-bus.c:assign_requested_resources_sorted
   Cyclomatic Complexity 12 drivers//pci/setup-bus.c:reassign_resources_sorted
   Cyclomatic Complexity 8 drivers//pci/setup-bus.c:assign_fixed_resource_on_bus
   Cyclomatic Complexity 15 drivers//pci/setup-bus.c:pdev_assign_fixed_resources
   Cyclomatic Complexity 20 drivers//pci/setup-bus.c:pci_bridge_release_resources
   Cyclomatic Complexity 13 drivers//pci/setup-bus.c:pci_bus_release_bridge_resources
   Cyclomatic Complexity 9 drivers//pci/setup-bus.c:pci_setup_cardbus
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pcibios_setup_bridge
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pci_setup_bridge
   Cyclomatic Complexity 11 drivers//pci/setup-bus.c:pci_claim_bridge_resource
   Cyclomatic Complexity 10 drivers//pci/setup-bus.c:pci_claim_bridge_resources
   Cyclomatic Complexity 4 drivers//pci/setup-bus.c:pci_bus_allocate_resources
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pcibios_window_alignment
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:window_alignment
   Cyclomatic Complexity 5 drivers//pci/setup-bus.c:pci_cardbus_resource_alignment
   Cyclomatic Complexity 5 drivers//pci/pci.h:pci_resource_alignment
   Cyclomatic Complexity 34 drivers//pci/setup-bus.c:pbus_size_io
   Cyclomatic Complexity 55 drivers//pci/setup-bus.c:pbus_size_mem
   Cyclomatic Complexity 18 drivers//pci/setup-bus.c:pdev_sort_resources
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:__dev_sort_resources
   Cyclomatic Complexity 26 drivers//pci/setup-bus.c:__assign_resources_sorted
   Cyclomatic Complexity 2 drivers//pci/setup-bus.c:pbus_assign_resources_sorted
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pdev_assign_resources_sorted
   Cyclomatic Complexity 61 drivers//pci/setup-bus.c:pci_bus_distribute_available_resources
   Cyclomatic Complexity 3 drivers//pci/setup-bus.c:pci_bridge_distribute_available_resources
   Cyclomatic Complexity 22 drivers//pci/setup-bus.c:__pci_bus_size_bridges
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pci_bus_size_bridges
   Cyclomatic Complexity 7 drivers//pci/setup-bus.c:__pci_bus_assign_resources
   Cyclomatic Complexity 5 drivers//pci/setup-bus.c:__pci_bridge_assign_resources
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pci_bus_assign_resources
   Cyclomatic Complexity 1 drivers//pci/setup-bus.c:pci_bus_claim_resources
   Cyclomatic Complexity 3 drivers//pci/setup-bus.c:pci_realloc_get_opt
   Cyclomatic Complexity 19 drivers//pci/setup-bus.c:pci_assign_unassigned_root_bus_resources
   Cyclomatic Complexity 5 drivers//pci/setup-bus.c:pci_assign_unassigned_resources
   Cyclomatic Complexity 10 drivers//pci/setup-bus.c:pci_assign_unassigned_bridge_resources

vim +/pci_dbg +1831 drivers/pci/setup-bus.c

  1816	
  1817	static void extend_bridge_window(struct pci_dev *bridge, struct resource *res,
  1818				struct list_head *add_list, resource_size_t available)
  1819	{
  1820		struct pci_dev_resource *dev_res;
  1821	
  1822		if (res->parent)
  1823			return;
  1824	
  1825		/*
  1826		 * Hot-adding multiple Thunderbolt devices in SL0 might result in
  1827		 * multiple devices being enumerated together. This can break the
  1828		 * resource allocation if the resource sizes are specified with
  1829		 * add_size instead of simply changing the resource size.
  1830		*/
> 1831		pci_dbg(bridge, "bridge window %pR extended by 0x%016llx\n", res,
  1832			available - resource_size(res));
  1833		res->end = res->start + available - 1;
  1834	
  1835		/*
  1836		 * If a list entry exists, we need to remove any additional size
  1837		 * requested because that could interfere with the alignment and
  1838		 * sizing done when distributing resources, causing resources to
  1839		 * fail to allocate later on.
  1840		 */
  1841		dev_res = res_to_dev_res(add_list, res);
  1842		if (!dev_res)
  1843			return;
  1844	
  1845		dev_res->add_size = 0;
  1846	}
  1847	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (27766 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ