# git rev-parse -q --verify 63355b9884b3d1677de6bd1517cd2b8a9bf53978^{commit} 63355b9884b3d1677de6bd1517cd2b8a9bf53978 already have revision, skipping fetch # git checkout -q -f -B kisskb 63355b9884b3d1677de6bd1517cd2b8a9bf53978 # git clean -qxdf # < git log -1 # commit 63355b9884b3d1677de6bd1517cd2b8a9bf53978 # Author: Linus Torvalds # Date: Tue Mar 7 12:16:18 2023 -0800 # # cpumask: be more careful with 'cpumask_setall()' # # Commit 596ff4a09b89 ("cpumask: re-introduce constant-sized cpumask # optimizations") changed cpumask_setall() to use "bitmap_set()" instead # of "bitmap_fill()", because bitmap_fill() would explicitly set all the # bits of a constant sized small bitmap, and that's exactly what we don't # want: we want to only set bits up to 'nr_cpu_ids', which is what # "bitmap_set()" does. # # However, Yury correctly points out that while "bitmap_set()" does indeed # only set bits up to the required bitmap size, it doesn't _clear_ bits # above that size, so the upper bits would still not have well-defined # values. # # Now, none of this should really matter, since any bits set past # 'nr_cpu_ids' should always be ignored in the first place. Yes, the bit # scanning functions might return them as a result, but since users should # always consider the ">= nr_cpu_ids" condition to mean "no more bits", # that shouldn't have any actual effect (see previous commit 8ca09d5fa354 # "cpumask: fix incorrect cpumask scanning result checks"). # # But let's just do it right, the way the code was _intended_ to work. We # have had enough lazy code that works but bites us in the *rse later # (again, see previous commit) that there's no reason to not just do this # properly. # # It turns out that "bitmap_fill()" gets this all right for the complex # case, and really only fails for the inlined optimized case that just # fills the whole word. And while we could just fix bitmap_fill() to use # the proper last word mask, there's two issues with that: # # - the cpumask case wants to do the _optimization_ based on "NR_CPUS is # a small constant", but then wants to do the actual bit _fill_ based # on "nr_cpu_ids" that isn't necessarily that same constant # # - we have lots of non-cpumask users of bitmap_fill(), and while they # hopefully don't care, and probably would want the proper semantics # anyway ("only set bits up to the limit"), I do not want the cpumask # changes to impact other parts # # So this ends up just doing the single-word optimization by hand in the # cpumask code. If our cpumask is fundamentally limited to a single word, # just do the proper "fill in that word" exactly. And if it's the more # complex multi-word case, then the generic bitmap_fill() will DTRT. # # This is all an example of how our bitmap function optimizations really # are somewhat broken. They conflate the "this is size of the bitmap" # optimizations with the actual bit(s) we want to set. # # In many cases we really want to have the two be separate things: # sometimes we base our optimizations on the size of the whole bitmap ("I # know this whole bitmap fits in a single word, so I'll just use # single-word accesses"), and sometimes we base them on the bit we are # looking at ("this is just acting on bits that are in the first word, so # I'll use single-word accesses"). # # Notice how the end result of the two optimizations are the same, but the # way we get to them are quite different. # # And all our cpumask optimization games are really about that fundamental # distinction, and we'd often really want to pass in both the "this is the # bit I'm working on" (which _can_ be a small constant but might be # variable), and "I know it's in this range even if it's variable" (based # on CONFIG_NR_CPUS). # # So this cpumask_setall() implementation just makes that explicit. It # checks the "I statically know the size is small" using the known static # size of the cpumask (which is what that 'small_cpumask_bits' is all # about), but then sets the actual bits using the exact number of cpus we # have (ie 'nr_cpumask_bits') # # Of course, in a perfect world, the compiler would have done all the # range analysis (possibly with help from us just telling it that # "this value is always in this range"), and would do all of this for us. # But that is not the world we live in. # # While we dream of that perfect world, this does that manual logic to # make it all work out. And this was a very long explanation for a small # code change that shouldn't even matter. # # Reported-by: Yury Norov # Link: https://lore.kernel.org/lkml/ZAV9nGG9e1%2FrV+L%2F@yury-laptop/ # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-12.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-12.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 63355b9884b3d1677de6bd1517cd2b8a9bf53978 # < make -s -j 160 ARCH=powerpc O=/kisskb/build/linus_ppc64_book3e_allmodconfig_powerpc-gcc12 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-12.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ppc64_book3e_allmodconfig # Added to kconfig CONFIG_GCC_PLUGINS=n # Added to kconfig # < make -s -j 160 ARCH=powerpc O=/kisskb/build/linus_ppc64_book3e_allmodconfig_powerpc-gcc12 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-12.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 160 ARCH=powerpc O=/kisskb/build/linus_ppc64_book3e_allmodconfig_powerpc-gcc12 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-12.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig # make -s -j 160 ARCH=powerpc O=/kisskb/build/linus_ppc64_book3e_allmodconfig_powerpc-gcc12 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-12.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- /kisskb/src/arch/powerpc/boot/dts/fsl/mvme7100.dts:135.22-137.4: Warning (pci_bridge): /pcie@f1008000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:92.7-117.3 /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:102.9-116.4: Warning (pci_bridge): /pcie@f1008000/pcie@0: missing ranges for PCI bridge (or not a bridge) /kisskb/src/arch/powerpc/boot/dts/fsl/mvme7100.dts:139.22-141.4: Warning (pci_bridge): /pcie@f1009000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:119.7-144.3 /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:129.9-143.4: Warning (pci_bridge): /pcie@f1009000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/mvme7100.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/mvme7100.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/mvme7100.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/mvme7100.dts:30.11-32.6: Warning (i2c_bus_reg): /soc@f1000000/i2c@3000/rtc@68: missing or empty reg property /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@fffe00000/mdio@24000/ethernet-phy@0:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@fffe00000/mdio@24000/ethernet-phy@1:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@ffe00000/mdio@24000/ethernet-phy@0:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@ffe00000/mdio@24000/ethernet-phy@1:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@fffe00000/mdio@24000/ethernet-phy@0:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@fffe00000/mdio@24000/ethernet-phy@1:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/kmcoge4.dts:196.23-198.4: Warning (pci_bridge): /pcie@ffe201000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi:87.7-113.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi:97.9-112.4: Warning (pci_bridge): /pcie@ffe201000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/kmcoge4.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/kmcoge4.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/kmcoge4.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/p1020rdb-pd.dts:189.11-193.6: Warning (spi_bus_reg): /soc@ffe00000/spi@7000/slic@0: SPI bus unit address format error, expected "1" /kisskb/src/arch/powerpc/boot/dts/fsl/p1020rdb-pd.dts:195.11-199.6: Warning (spi_bus_reg): /soc@ffe00000/spi@7000/slic@1: SPI bus unit address format error, expected "2" /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8555cds.dts:341.15-350.5: Warning (pci_device_reg): /pci@e0008000/i8259@19000: PCI unit address format error, expected "12,0" /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8555cds.dts:330.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@ffe00000/mdio@24000/ethernet-phy@0:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi:38.2-25: Warning (interrupts_property): /soc@ffe00000/mdio@24000/ethernet-phy@1:#interrupt-cells: size is (8), expected multiple of 16 /kisskb/src/arch/powerpc/boot/dts/bluestone.dts:272.13-277.7: Warning (i2c_bus_reg): /plb/opb/i2c@ef600700/sttm@4C: I2C bus unit address format error, expected "4c" /kisskb/src/arch/powerpc/boot/dts/fsl/gef_sbc610.dts:209.22-211.4: Warning (pci_bridge): /pcie@fef09000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:119.7-144.3 /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:129.9-143.4: Warning (pci_bridge): /pcie@fef09000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/gef_sbc610.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/gef_sbc610.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/gef_sbc610.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/mpc5121.dtsi:457.13-466.5: Warning (spi_bus_bridge): /soc@80000000/psc@11900: node name for SPI buses should be 'spi' also defined at /kisskb/src/arch/powerpc/boot/dts/pdm360ng.dts:172.13-185.5 arch/powerpc/boot/dts/pdm360ng.dtb: Warning (spi_bus_reg): Failed prerequisite 'spi_bus_bridge' /kisskb/src/arch/powerpc/boot/dts/stxssa8555.dts:342.15-351.5: Warning (pci_device_reg): /pci@e0008000/i8259@19000: PCI unit address format error, expected "12,0" /kisskb/src/arch/powerpc/boot/dts/stxssa8555.dts:331.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) /kisskb/src/arch/powerpc/boot/dts/mpc8610_hpcd.dts:420.3-21: Warning (pci_device_bus_num): /pcie@e000a000/pcie@0:bus-range: PCI bus number 0 out of range, expected (1 - 3) /kisskb/src/arch/powerpc/boot/dts/fsl/gef_ppc9a.dts:211.22-213.4: Warning (pci_bridge): /pcie@fef09000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:119.7-144.3 /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8641si-post.dtsi:129.9-143.4: Warning (pci_bridge): /pcie@fef09000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/gef_ppc9a.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/gef_ppc9a.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/gef_ppc9a.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/mpc5121.dtsi:397.13-406.5: Warning (spi_bus_bridge): /soc@80000000/psc@11400: node name for SPI buses should be 'spi' also defined at /kisskb/src/arch/powerpc/boot/dts/ac14xx.dts:305.19-326.5 /kisskb/src/arch/powerpc/boot/dts/mpc5121.dtsi:409.13-418.5: Warning (spi_bus_bridge): /soc@80000000/psc@11500: node name for SPI buses should be 'spi' also defined at /kisskb/src/arch/powerpc/boot/dts/ac14xx.dts:329.19-344.5 arch/powerpc/boot/dts/ac14xx.dtb: Warning (spi_bus_reg): Failed prerequisite 'spi_bus_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/ppa8548.dts:34.22-37.4: Warning (pci_bridge): /pci@fe0008000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi:43.7-51.3 /kisskb/src/arch/powerpc/boot/dts/fsl/ppa8548.dts:39.22-42.4: Warning (pci_bridge): /pci@fe0009000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi:54.7-62.3 /kisskb/src/arch/powerpc/boot/dts/fsl/ppa8548.dts:44.23-47.4: Warning (pci_bridge): /pcie@fe000a000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi:65.7-90.3 /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi:74.9-89.4: Warning (pci_bridge): /pcie@fe000a000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/ppa8548.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/ppa8548.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/ppa8548.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/oca4080.dts:132.23-134.4: Warning (pci_bridge): /pcie@ffe200000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi:58.7-84.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi:68.9-83.4: Warning (pci_bridge): /pcie@ffe200000/pcie@0: missing ranges for PCI bridge (or not a bridge) /kisskb/src/arch/powerpc/boot/dts/fsl/oca4080.dts:136.23-138.4: Warning (pci_bridge): /pcie@ffe201000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi:87.7-113.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi:97.9-112.4: Warning (pci_bridge): /pcie@ffe201000/pcie@0: missing ranges for PCI bridge (or not a bridge) /kisskb/src/arch/powerpc/boot/dts/fsl/oca4080.dts:140.23-142.4: Warning (pci_bridge): /pcie@ffe202000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi:116.7-142.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi:126.9-141.4: Warning (pci_bridge): /pcie@ffe202000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/oca4080.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/oca4080.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/oca4080.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/p2020rdb-pc_36b.dts:59.23-62.4: Warning (pci_bridge): /pcie@fffe08000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi:102.7-129.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi:112.9-128.4: Warning (pci_bridge): /pcie@fffe08000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/p2020rdb-pc_36b.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/p2020rdb-pc_36b.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/p2020rdb-pc_36b.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/p2020rdb-pc_32b.dts:59.22-62.4: Warning (pci_bridge): /pcie@ffe08000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi:102.7-129.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi:112.9-128.4: Warning (pci_bridge): /pcie@ffe08000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/p2020rdb-pc_32b.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/p2020rdb-pc_32b.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/p2020rdb-pc_32b.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8541cds.dts:341.15-350.5: Warning (pci_device_reg): /pci@e0008000/i8259@19000: PCI unit address format error, expected "12,0" /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8541cds.dts:330.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) /kisskb/src/arch/powerpc/boot/dts/fsl/p2020rdb.dts:251.22-254.4: Warning (pci_bridge): /pcie@ffe08000: missing ranges for PCI bridge (or not a bridge) also defined at /kisskb/src/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi:43.7-69.3 /kisskb/src/arch/powerpc/boot/dts/fsl/p2020si-post.dtsi:53.9-68.4: Warning (pci_bridge): /pcie@ffe08000/pcie@0: missing ranges for PCI bridge (or not a bridge) arch/powerpc/boot/dts/fsl/p2020rdb.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/p2020rdb.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge' arch/powerpc/boot/dts/fsl/p2020rdb.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' Completed OK # rm -rf /kisskb/build/linus_ppc64_book3e_allmodconfig_powerpc-gcc12 # Build took: 0:16:20.774378