Skip to contentSkip to conversation

drm/i915/buddy: document the unused header bits

PATCH In review Matthew Auld 4 participants 6 messages Jan 22, 2021 – Jan 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/buddy: document the unused header bits

The largest possible order is (63-12), given that our min chunk size is 4K. With that we should only need at most 6 bits to represent all possible orders, giving us back 4 bits for other potential uses. Include a simple selftest to verify this.

---
 drivers/gpu/drm/i915/i915_buddy.c           |  3 ++
 drivers/gpu/drm/i915/i915_buddy.h           |  7 ++-
 drivers/gpu/drm/i915/selftests/i915_buddy.c | 47 +++++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_buddy.c +3 -0
index 20babbdb297d..650613ae2a7b 100644
@@ -56,6 +56,9 @@ static struct i915_buddy_block *i915_block_alloc(struct i915_buddy_block *parent
 	block->header |= order;
 	block->parent = parent;
 
+	GEM_BUG_ON(block->header & I915_BUDDY_HEADER_UNUSED);
+	GEM_BUG_ON(order > I915_BUDDY_MAX_ORDER);
+
 	return block;
 }
 
drivers/gpu/drm/i915/i915_buddy.h +5 -2
index ed41f3507cdc..d37e03587637 100644
@@ -15,7 +15,9 @@ struct i915_buddy_block {
 #define   I915_BUDDY_ALLOCATED	   (1 << 10)
 #define   I915_BUDDY_FREE	   (2 << 10)
 #define   I915_BUDDY_SPLIT	   (3 << 10)
-#define I915_BUDDY_HEADER_ORDER  GENMASK_ULL(9, 0)
+/* Free to be used, if needed in the future */
+#define I915_BUDDY_HEADER_UNUSED GENMASK_ULL(9, 6)
+#define I915_BUDDY_HEADER_ORDER  GENMASK_ULL(5, 0)
 	u64 header;
 
 	struct i915_buddy_block *left;
@@ -34,7 +36,8 @@ struct i915_buddy_block {
 	struct list_head tmp_link;
 };
 
-#define I915_BUDDY_MAX_ORDER  I915_BUDDY_HEADER_ORDER
+/* Order-zero must be at least PAGE_SIZE */
+#define I915_BUDDY_MAX_ORDER (63 - 12)
 
 /*
  * Binary Buddy System.
drivers/gpu/drm/i915/selftests/i915_buddy.c +47 -0

59 lines not on this page · raw message

Signature · 6 lines
2.26.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw

Quoting Matthew Auld (2021-01-22 15:45:46)

Quoted 17 lines

The largest possible order is (63-12), given that our min chunk size is 4K. With that we should only need at most 6 bits to represent all possible orders, giving us back 4 bits for other potential uses. Include a simple selftest to verify this.

---
 drivers/gpu/drm/i915/i915_buddy.c           |  3 ++
 drivers/gpu/drm/i915/i915_buddy.h           |  7 ++-
 drivers/gpu/drm/i915/selftests/i915_buddy.c | 47 +++++++++++++++++++++
 3 files changed, 55 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_buddy.c +0 -0
index 20babbdb297d..650613ae2a7b 100644

drivers/gpu/drm/i915/i915_buddy.c static struct i915_buddy_block *i915_block_alloc(struct i915_buddy_block *parent · line 59

Quoted 4 lines
drivers/gpu/drm/i915/i915_buddy.c +1 -0
@@ -56,6 +56,9 @@ static struct i915_buddy_block *i915_block_alloc(struct i915_buddy_block *parent
        block->header |= order;
        block->parent = parent;
 
+       GEM_BUG_ON(block->header & I915_BUDDY_HEADER_UNUSED);

Ok...

drivers/gpu/drm/i915/i915_buddy.c static struct i915_buddy_block *i915_block_alloc(struct i915_buddy_block *parent · line 60

Quoted 1 line
drivers/gpu/drm/i915/i915_buddy.c +1 -0
+       GEM_BUG_ON(order > I915_BUDDY_MAX_ORDER);

But this is really a contract on the incoming parameter and so should be at the start of the function.

GEM_BUG_ON(block->header...) is a contract on our output.

Quoted 20 lines
drivers/gpu/drm/i915/i915_buddy.c +1 -0
+
        return block;
 }
 
drivers/gpu/drm/i915/i915_buddy.h +3 -1
index ed41f3507cdc..d37e03587637 100644
@@ -15,7 +15,9 @@ struct i915_buddy_block {
 #define   I915_BUDDY_ALLOCATED    (1 << 10)
 #define   I915_BUDDY_FREE         (2 << 10)
 #define   I915_BUDDY_SPLIT        (3 << 10)
-#define I915_BUDDY_HEADER_ORDER  GENMASK_ULL(9, 0)
+/* Free to be used, if needed in the future */
+#define I915_BUDDY_HEADER_UNUSED GENMASK_ULL(9, 6)
+#define I915_BUDDY_HEADER_ORDER  GENMASK_ULL(5, 0)
        u64 header;
 
        struct i915_buddy_block *left;

drivers/gpu/drm/i915/i915_buddy.h struct i915_buddy_block { · line 40

Quoted 6 lines
drivers/gpu/drm/i915/i915_buddy.h +2 -1
@@ -34,7 +36,8 @@ struct i915_buddy_block {
        struct list_head tmp_link;
 };
 
-#define I915_BUDDY_MAX_ORDER  I915_BUDDY_HEADER_ORDER
+/* Order-zero must be at least PAGE_SIZE */
+#define I915_BUDDY_MAX_ORDER (63 - 12)

Can we replace 12 with an ilog2() ?

PAGE_SIZE is mentioned as the lower limit, so PAGE_SHIFT?

Quoted 8 lines
drivers/gpu/drm/i915/i915_buddy.h +0 -0
 /*
  * Binary Buddy System.
drivers/gpu/drm/i915/selftests/i915_buddy.c +0 -0
index 632b912b0bc9..39c470a0e28d 100644
@@ -727,6 +727,52 @@ static int igt_buddy_alloc_range(void *arg)
        return err;

drivers/gpu/drm/i915/selftests/i915_buddy.c static int igt_buddy_alloc_range(void *arg) · line 737

Quoted 10 lines
drivers/gpu/drm/i915/selftests/i915_buddy.c +8 -0
 }
 
+static int igt_buddy_alloc_limit(void *arg)
+{
+       struct i915_buddy_block *block;
+       struct i915_buddy_mm mm;
+       const u64 size = U64_MAX;
+       int err;
+
+       err = i915_buddy_init(&mm, size, PAGE_SIZE);

Create the biggest region possible.

drivers/gpu/drm/i915/selftests/i915_buddy.c static int igt_buddy_alloc_range(void *arg) · line 741

Quoted 4 lines
drivers/gpu/drm/i915/selftests/i915_buddy.c +4 -0
+       if (err)
+               return err;
+
+       if (mm.max_order != I915_BUDDY_MAX_ORDER) {

Check that we made it as big as possible.

drivers/gpu/drm/i915/selftests/i915_buddy.c static int igt_buddy_alloc_range(void *arg) · line 748

Quoted 7 lines
drivers/gpu/drm/i915/selftests/i915_buddy.c +7 -0
+               pr_err("mm.max_order(%d) != %d\n",
+                      mm.max_order, I915_BUDDY_MAX_ORDER);
+               err = -EINVAL;
+               goto out_fini;
+       }
+
+       block = i915_buddy_alloc(&mm, mm.max_order);

Allocate the largest single block.

drivers/gpu/drm/i915/selftests/i915_buddy.c static int igt_buddy_alloc_range(void *arg) · line 754

Quoted 6 lines
drivers/gpu/drm/i915/selftests/i915_buddy.c +6 -0
+       if (IS_ERR(block)) {
+               err = PTR_ERR(block);
+               goto out_fini;
+       }
+
+       if (i915_buddy_block_order(block) != I915_BUDDY_MAX_ORDER) {

Check that it is as large we tried to allocate... But it should be mm.max_order to check the actual limits in place.

drivers/gpu/drm/i915/selftests/i915_buddy.c static int igt_buddy_alloc_range(void *arg) · line 761

Quoted 7 lines
drivers/gpu/drm/i915/selftests/i915_buddy.c +7 -0
+               pr_err("block order(%d) != %d\n",
+                      i915_buddy_block_order(block), I915_BUDDY_MAX_ORDER);
+               err = -EINVAL;
+               goto out_free;
+       }
+
+       if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {

Which is the largest buddy block within the range.

Hmm, this I don't think follows the I915_BUDDY_MAX_ORDER constraint. What if we reduce the MAX_ORDER to be say 48? Then the buddy block will correctly be (1<<48). So I think you just want size() == BIT_ULL(mm.max_order)

With those questions addressed however you see fit,

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/buddy: document the unused header bits

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/buddy: document the unused header bits
URL : https://patchwork.freedesktop.org/series/86189/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9670 -> Patchwork_19463
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/index.html

Known issues
------------

Here are the changes found in Patchwork_19463 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_basic@userptr:
- fi-byt-j1900: NOTRUN -> [SKIP][1] ([fdo#109271]) +17 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/fi-byt-j1900/igt@amdgpu/[email protected]

* igt@prime_vgem@basic-write:
- fi-tgl-y: [PASS][2] -> [DMESG-WARN][3] ([i915#402])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/fi-tgl-y/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/fi-tgl-y/igt@[email protected]

#### Possible fixes ####

* igt@i915_pm_rpm@module-reload:
- fi-byt-j1900: [INCOMPLETE][4] ([i915#142] / [i915#2405]) -> [PASS][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/fi-byt-j1900/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/fi-byt-j1900/igt@[email protected]

* igt@vgem_basic@setversion:
- fi-tgl-y: [DMESG-WARN][6] ([i915#402]) -> [PASS][7] +1 similar issue
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/fi-tgl-y/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/fi-tgl-y/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#142]: https://gitlab.freedesktop.org/drm/intel/issues/142
[i915#2405]: https://gitlab.freedesktop.org/drm/intel/issues/2405
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402

Participating hosts (41 -> 36)
------------------------------

Missing (5): fi-ilk-m540 fi-hsw-4200u fi-tgl-u2 fi-bsw-cyan fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_9670 -> Patchwork_19463

CI-20190529: 20190529
CI_DRM_9670: 85fd189b9fbfb6e7af8d956d37be012fdd6ae0ad @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5964: 0949766cb9846d7d55fac9cdf31d3d8e8ed1d0c6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19463: d40bd326c7456786c259d599b0a40c9950747c86 @ git://anongit.freedesktop.org/gfx-ci/linux

== Kernel 32bit build ==

Warning: Kernel 32bit buildtest failed:
https://intel-gfx-ci.01.org/Patchwork_19463/build_32bit.log

  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  CHK     include/generated/compile.h
  CC [M]  drivers/gpu/drm/i915/i915_buddy.o
In file included from ./include/linux/kernel.h:12,
                 from ./include/asm-generic/bug.h:20,
                 from ./arch/x86/include/asm/bug.h:93,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/gfp.h:5,
                 from ./include/linux/slab.h:15,
                 from ./include/linux/kmemleak.h:12,
                 from drivers/gpu/drm/i915/i915_buddy.c:6:
drivers/gpu/drm/i915/selftests/i915_buddy.c: In function ‘igt_buddy_alloc_limit’:
./include/linux/log2.h:194:8: error: left shift count >= width of type [-Werror=shift-count-overflow]
   (1UL << ilog2(n))) :  \
        ^~
drivers/gpu/drm/i915/selftests/i915_buddy.c:761:43: note: in expansion of macro ‘rounddown_pow_of_two’
  if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {
                                           ^~~~~~~~~~~~~~~~~~~~
./include/linux/log2.h:194:8: error: left shift count >= width of type [-Werror=shift-count-overflow]
   (1UL << ilog2(n))) :  \
        ^~
./include/linux/printk.h:343:33: note: in expansion of macro ‘rounddown_pow_of_two’
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                 ^~~~~~~~~~~

drivers/gpu/drm/i915/selftests/i915_buddy.c:762:3: note: in expansion of macro ‘pr_err’
pr_err("block size(%llu) != %lu\n",
^~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:279: recipe for target 'drivers/gpu/drm/i915/i915_buddy.o' failed make[4]: *** [drivers/gpu/drm/i915/i915_buddy.o] Error 1 scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:496: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1805: recipe for target 'drivers' failed
make: *** [drivers] Error 2

== Linux commits ==

d40bd326c745 drm/i915/buddy: document the unused header bits

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: warning for drm/i915/buddy: document the unused header bits

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/buddy: document the unused header bits
URL : https://patchwork.freedesktop.org/series/86189/
State : warning

== Summary ==

CALL scripts/checksyscalls.sh

  CALL    scripts/atomic/check-atomics.sh
  CHK     include/generated/compile.h
  CC [M]  drivers/gpu/drm/i915/i915_buddy.o
In file included from ./include/linux/kernel.h:12,
                 from ./include/asm-generic/bug.h:20,
                 from ./arch/x86/include/asm/bug.h:93,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/gfp.h:5,
                 from ./include/linux/slab.h:15,
                 from ./include/linux/kmemleak.h:12,
                 from drivers/gpu/drm/i915/i915_buddy.c:6:
drivers/gpu/drm/i915/selftests/i915_buddy.c: In function ‘igt_buddy_alloc_limit’:
./include/linux/log2.h:194:8: error: left shift count >= width of type [-Werror=shift-count-overflow]
   (1UL << ilog2(n))) :  \
        ^~
drivers/gpu/drm/i915/selftests/i915_buddy.c:761:43: note: in expansion of macro ‘rounddown_pow_of_two’
  if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {
                                           ^~~~~~~~~~~~~~~~~~~~
./include/linux/log2.h:194:8: error: left shift count >= width of type [-Werror=shift-count-overflow]
   (1UL << ilog2(n))) :  \
        ^~
./include/linux/printk.h:343:33: note: in expansion of macro ‘rounddown_pow_of_two’
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                 ^~~~~~~~~~~

drivers/gpu/drm/i915/selftests/i915_buddy.c:762:3: note: in expansion of macro ‘pr_err’
pr_err("block size(%llu) != %lu\n",
^~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:279: recipe for target 'drivers/gpu/drm/i915/i915_buddy.o' failed make[4]: *** [drivers/gpu/drm/i915/i915_buddy.o] Error 1 scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:496: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1805: recipe for target 'drivers' failed
make: *** [drivers] Error 2

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/build_32bit.log
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/buddy: document the unused header bits

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/buddy: document the unused header bits
URL : https://patchwork.freedesktop.org/series/86189/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9670_full -> Patchwork_19463_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_19463_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_persistence@close-replace-race:
- shard-glk: [PASS][1] -> [TIMEOUT][2] ([i915#2918])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-glk4/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-glk7/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-glk: [PASS][3] -> [FAIL][4] ([i915#2846])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-glk7/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-glk4/igt@[email protected]

* igt@gem_exec_fair@basic-none-vip@rcs0:
- shard-kbl: [PASS][5] -> [FAIL][6] ([i915#2842])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-kbl2/igt@gem_exec_fair@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-kbl2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-tglb: [PASS][7] -> [FAIL][8] ([i915#2842]) +2 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb7/igt@gem_exec_fair@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb8/igt@gem_exec_fair@[email protected]
- shard-glk: [PASS][9] -> [FAIL][10] ([i915#2842])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-glk4/igt@gem_exec_fair@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-glk2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-iclb: NOTRUN -> [FAIL][11] ([i915#2842])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_schedule@u-fairslice@bcs0:
- shard-tglb: [PASS][12] -> [DMESG-WARN][13] ([i915#2803])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb1/igt@gem_exec_schedule@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb5/igt@gem_exec_schedule@[email protected]

* igt@gem_fenced_exec_thrash@no-spare-fences:
- shard-snb: [PASS][14] -> [INCOMPLETE][15] ([i915#2055])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-snb4/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-snb6/igt@[email protected]

* igt@i915_pm_dc@dc6-dpms:
- shard-skl: NOTRUN -> [FAIL][16] ([i915#454])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl7/igt@[email protected]

* igt@i915_selftest@live@late_gt_pm:
- shard-skl: NOTRUN -> [INCOMPLETE][17] ([i915#198])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl3/igt@i915_selftest@live@late_gt_pm.html

* igt@kms_async_flips@test-time-stamp:
- shard-tglb: [PASS][18] -> [FAIL][19] ([i915#2597])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb8/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb2/igt@[email protected]

* igt@kms_color@pipe-a-ctm-0-75:
- shard-skl: [PASS][20] -> [DMESG-WARN][21] ([i915#1982]) +1 similar issue
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl1/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl4/igt@[email protected]

* igt@kms_color_chamelium@pipe-invalid-degamma-lut-sizes:
- shard-skl: NOTRUN -> [SKIP][22] ([fdo#109271] / [fdo#111827]) +6 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl7/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-256x256-offscreen:
- shard-skl: [PASS][23] -> [FAIL][24] ([i915#54]) +3 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl5/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl3/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-skl: [PASS][25] -> [FAIL][26] ([i915#2346])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl3/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl10/igt@[email protected]

* igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
- shard-skl: NOTRUN -> [SKIP][27] ([fdo#109271]) +50 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl6/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@a-edp1:
- shard-skl: [PASS][28] -> [FAIL][29] ([i915#79])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl6/igt@kms_flip@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl10/igt@kms_flip@[email protected]
- shard-tglb: [PASS][30] -> [FAIL][31] ([i915#2598])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb8/igt@kms_flip@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb2/igt@kms_flip@[email protected]

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [PASS][32] -> [FAIL][33] ([i915#1188]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl8/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-skl: NOTRUN -> [FAIL][34] ([fdo#108145] / [i915#265])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [PASS][35] -> [FAIL][36] ([fdo#108145] / [i915#265]) +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl10/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl2/igt@[email protected]

* igt@kms_psr@psr2_sprite_mmap_gtt:
- shard-iclb: [PASS][37] -> [SKIP][38] ([fdo#109441]) +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_gtt.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb3/igt@kms_psr@psr2_sprite_mmap_gtt.html

* igt@sysfs_heartbeat_interval@mixed@rcs0:
- shard-kbl: [PASS][39] -> [INCOMPLETE][40] ([i915#1731])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-kbl2/igt@sysfs_heartbeat_interval@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-kbl7/igt@sysfs_heartbeat_interval@[email protected]

#### Possible fixes ####

* igt@gem_exec_fair@basic-none@vcs0:
- shard-kbl: [FAIL][41] ([i915#2842]) -> [PASS][42] +1 similar issue
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-kbl2/igt@gem_exec_fair@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-kbl4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-tglb: [FAIL][43] ([i915#2842]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb7/igt@gem_exec_fair@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-glk: [FAIL][45] ([i915#2842]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-glk4/igt@gem_exec_fair@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-glk7/igt@gem_exec_fair@[email protected]
- shard-iclb: [FAIL][47] ([i915#2849]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-iclb7/igt@gem_exec_fair@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_whisper@basic-queues:
- shard-glk: [DMESG-WARN][49] ([i915#118] / [i915#95]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-glk7/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-glk3/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- shard-tglb: [SKIP][51] ([i915#2190]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb6/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb8/igt@[email protected]

* igt@gen9_exec_parse@allowed-single:
- shard-skl: [DMESG-WARN][53] ([i915#1436] / [i915#716]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl8/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl7/igt@[email protected]

* igt@i915_selftest@live@execlists:
- shard-skl: [INCOMPLETE][55] ([CI#80] / [i915#1037]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl7/igt@i915_selftest@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl3/igt@i915_selftest@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-128x128-random:
- shard-skl: [FAIL][57] ([i915#54]) -> [PASS][58] +8 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl5/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl6/igt@[email protected]

* igt@kms_flip@flip-vs-dpms-off-vs-modeset-interruptible@a-edp1:
- shard-skl: [DMESG-WARN][59] ([i915#1982]) -> [PASS][60] +1 similar issue
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl7/igt@kms_flip@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl3/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@b-edp1:
- shard-skl: [FAIL][61] ([i915#79]) -> [PASS][62] +1 similar issue
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl1/igt@kms_flip@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl5/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@b-edp1:
- shard-skl: [FAIL][63] ([i915#2122]) -> [PASS][64] +3 similar issues
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl9/igt@kms_flip@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl1/igt@kms_flip@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- shard-skl: [INCOMPLETE][65] ([i915#198]) -> [PASS][66]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl2/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: [FAIL][67] ([fdo#108145] / [i915#265]) -> [PASS][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl8/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl5/igt@[email protected]

* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [SKIP][69] ([fdo#109441]) -> [PASS][70] +1 similar issue
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-iclb4/igt@kms_psr@psr2_primary_page_flip.html
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html

* igt@perf_pmu@module-unload:
- shard-skl: [DMESG-WARN][71] ([i915#1982] / [i915#262]) -> [PASS][72]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl3/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl9/igt@[email protected]

#### Warnings ####

* igt@gem_exec_fair@basic-none-rrul@rcs0:
- shard-iclb: [FAIL][73] ([i915#2852]) -> [FAIL][74] ([i915#2842])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-iclb8/igt@gem_exec_fair@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb2/igt@gem_exec_fair@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1:
- shard-iclb: [SKIP][75] ([i915#658]) -> [SKIP][76] ([i915#2920]) +1 similar issue
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-iclb8/igt@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1:
- shard-iclb: [SKIP][77] ([i915#2920]) -> [SKIP][78] ([i915#658])
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-iclb2/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-iclb3/igt@[email protected]

* igt@runner@aborted:
- shard-tglb: [FAIL][79] ([i915#1602] / [i915#2295] / [i915#2667]) -> ([FAIL][80], [FAIL][81]) ([i915#1602] / [i915#2295] / [i915#2426] / [i915#2667] / [i915#2803])
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-tglb7/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb5/igt@[email protected]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-tglb3/igt@[email protected]
- shard-skl: ([FAIL][82], [FAIL][83]) ([i915#1436] / [i915#2295]) -> [FAIL][84] ([i915#2295])
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl8/igt@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9670/shard-skl3/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/shard-skl10/igt@[email protected]

[CI#80]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/80
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1037]: https://gitlab.freedesktop.org/drm/intel/issues/1037
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#1731]: https://gitlab.freedesktop.org/drm/intel/issues/1731
[i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2055]: https://gitlab.freedesktop.org/drm/intel/issues/2055
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2295]: https://gitlab.freedesktop.org/drm/intel/issues/2295
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2597]: https://gitlab.freedesktop.org/drm/intel/issues/2597
[i915#2598]: https://gitlab.freedesktop.org/drm/intel/issues/2598
[i915#262]: https://gitlab.freedesktop.org/drm/intel/issues/262
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#2667]: https://gitlab.freedesktop.org/drm/intel/issues/2667
[i915#2803]: https://gitlab.freedesktop.org/drm/intel/issues/2803
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#2849]: https://gitlab.freedesktop.org/drm/intel/issues/2849
[i915#2852]: https://gitlab.freedesktop.org/drm/intel/issues/2852
[i915#2918]: https://gitlab.freedesktop.org/drm/intel/issues/2918
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#716]: https://gitlab.freedesktop.org/drm/intel/issues/716
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_9670 -> Patchwork_19463

CI-20190529: 20190529
CI_DRM_9670: 85fd189b9fbfb6e7af8d956d37be012fdd6ae0ad @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5964: 0949766cb9846d7d55fac9cdf31d3d8e8ed1d0c6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19463: d40bd326c7456786c259d599b0a40c9950747c86 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19463/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Matthew Auld
Thank you for the patch! Perhaps something to improve:

Hi Matthew,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip v5.11-rc5 next-20210122] [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/Matthew-Auld/drm-i915-buddy-document-the-unused-header-bits/20210125-111101
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-a012-20210125 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-20) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/9d12a23788459bd678c0f5979acaaf94a88d808c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Matthew-Auld/drm-i915-buddy-document-the-unused-header-bits/20210125-111101
        git checkout 9d12a23788459bd678c0f5979acaaf94a88d808c
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:5,

                    from arch/x86/include/asm/bug.h:93,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from include/linux/kmemleak.h:12,
                    from drivers/gpu/drm/i915/i915_buddy.c:6:
   drivers/gpu/drm/i915/selftests/i915_buddy.c: In function 'igt_buddy_alloc_limit':
>> include/linux/log2.h:194:8: warning: left shift count >= width of type [-Wshift-count-overflow]
     194 |   (1UL << ilog2(n))) :  \
         |        ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:2: note: in expansion of macro 'if'
     761 |  if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {
         |  ^~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:43: note: in expansion of macro 'rounddown_pow_of_two'
     761 |  if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {
         |                                           ^~~~~~~~~~~~~~~~~~~~
>> include/linux/log2.h:194:8: warning: left shift count >= width of type [-Wshift-count-overflow]
     194 |   (1UL << ilog2(n))) :  \
         |        ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:2: note: in expansion of macro 'if'
     761 |  if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {
         |  ^~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:43: note: in expansion of macro 'rounddown_pow_of_two'
     761 |  if (i915_buddy_block_size(&mm, block) != rounddown_pow_of_two(size)) {
         |                                           ^~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:20,
                    from arch/x86/include/asm/bug.h:93,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from include/linux/kmemleak.h:12,
                    from drivers/gpu/drm/i915/i915_buddy.c:6:
>> include/linux/log2.h:194:8: warning: left shift count >= width of type [-Wshift-count-overflow]
     194 |   (1UL << ilog2(n))) :  \
         |        ^~
   include/linux/printk.h:343:33: note: in expansion of macro 'rounddown_pow_of_two'
     343 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                                 ^~~~~~~~~~~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:762:3: note: in expansion of macro 'pr_err'
     762 |   pr_err("block size(%llu) != %lu\n",
         |   ^~~~~~

vim +194 include/linux/log2.h

b311e921b385b5a Robert P. J. Day 2007-10-16   69  
f0d1b0b30d250a0 David Howells    2006-12-08   70  /**
dbef91ec5482239 Martin Wilck     2018-04-18   71   * const_ilog2 - log base 2 of 32-bit or a 64-bit constant unsigned value
a1c4d24e02d093e Randy Dunlap     2017-09-30   72   * @n: parameter
f0d1b0b30d250a0 David Howells    2006-12-08   73   *
dbef91ec5482239 Martin Wilck     2018-04-18   74   * Use this where sparse expects a true constant expression, e.g. for array
dbef91ec5482239 Martin Wilck     2018-04-18   75   * indices.
f0d1b0b30d250a0 David Howells    2006-12-08   76   */
dbef91ec5482239 Martin Wilck     2018-04-18   77  #define const_ilog2(n)				\
f0d1b0b30d250a0 David Howells    2006-12-08   78  (						\
f0d1b0b30d250a0 David Howells    2006-12-08   79  	__builtin_constant_p(n) ? (		\
474c90156c8dcc2 Linus Torvalds   2017-03-02   80  		(n) < 2 ? 0 :			\
f0d1b0b30d250a0 David Howells    2006-12-08   81  		(n) & (1ULL << 63) ? 63 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   82  		(n) & (1ULL << 62) ? 62 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   83  		(n) & (1ULL << 61) ? 61 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   84  		(n) & (1ULL << 60) ? 60 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   85  		(n) & (1ULL << 59) ? 59 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   86  		(n) & (1ULL << 58) ? 58 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   87  		(n) & (1ULL << 57) ? 57 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   88  		(n) & (1ULL << 56) ? 56 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   89  		(n) & (1ULL << 55) ? 55 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   90  		(n) & (1ULL << 54) ? 54 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   91  		(n) & (1ULL << 53) ? 53 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   92  		(n) & (1ULL << 52) ? 52 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   93  		(n) & (1ULL << 51) ? 51 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   94  		(n) & (1ULL << 50) ? 50 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   95  		(n) & (1ULL << 49) ? 49 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   96  		(n) & (1ULL << 48) ? 48 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   97  		(n) & (1ULL << 47) ? 47 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   98  		(n) & (1ULL << 46) ? 46 :	\
f0d1b0b30d250a0 David Howells    2006-12-08   99  		(n) & (1ULL << 45) ? 45 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  100  		(n) & (1ULL << 44) ? 44 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  101  		(n) & (1ULL << 43) ? 43 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  102  		(n) & (1ULL << 42) ? 42 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  103  		(n) & (1ULL << 41) ? 41 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  104  		(n) & (1ULL << 40) ? 40 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  105  		(n) & (1ULL << 39) ? 39 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  106  		(n) & (1ULL << 38) ? 38 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  107  		(n) & (1ULL << 37) ? 37 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  108  		(n) & (1ULL << 36) ? 36 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  109  		(n) & (1ULL << 35) ? 35 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  110  		(n) & (1ULL << 34) ? 34 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  111  		(n) & (1ULL << 33) ? 33 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  112  		(n) & (1ULL << 32) ? 32 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  113  		(n) & (1ULL << 31) ? 31 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  114  		(n) & (1ULL << 30) ? 30 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  115  		(n) & (1ULL << 29) ? 29 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  116  		(n) & (1ULL << 28) ? 28 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  117  		(n) & (1ULL << 27) ? 27 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  118  		(n) & (1ULL << 26) ? 26 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  119  		(n) & (1ULL << 25) ? 25 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  120  		(n) & (1ULL << 24) ? 24 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  121  		(n) & (1ULL << 23) ? 23 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  122  		(n) & (1ULL << 22) ? 22 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  123  		(n) & (1ULL << 21) ? 21 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  124  		(n) & (1ULL << 20) ? 20 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  125  		(n) & (1ULL << 19) ? 19 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  126  		(n) & (1ULL << 18) ? 18 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  127  		(n) & (1ULL << 17) ? 17 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  128  		(n) & (1ULL << 16) ? 16 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  129  		(n) & (1ULL << 15) ? 15 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  130  		(n) & (1ULL << 14) ? 14 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  131  		(n) & (1ULL << 13) ? 13 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  132  		(n) & (1ULL << 12) ? 12 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  133  		(n) & (1ULL << 11) ? 11 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  134  		(n) & (1ULL << 10) ? 10 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  135  		(n) & (1ULL <<  9) ?  9 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  136  		(n) & (1ULL <<  8) ?  8 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  137  		(n) & (1ULL <<  7) ?  7 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  138  		(n) & (1ULL <<  6) ?  6 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  139  		(n) & (1ULL <<  5) ?  5 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  140  		(n) & (1ULL <<  4) ?  4 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  141  		(n) & (1ULL <<  3) ?  3 :	\
f0d1b0b30d250a0 David Howells    2006-12-08  142  		(n) & (1ULL <<  2) ?  2 :	\
474c90156c8dcc2 Linus Torvalds   2017-03-02  143  		1) :				\
dbef91ec5482239 Martin Wilck     2018-04-18  144  	-1)
dbef91ec5482239 Martin Wilck     2018-04-18  145  
dbef91ec5482239 Martin Wilck     2018-04-18  146  /**
dbef91ec5482239 Martin Wilck     2018-04-18  147   * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value
dbef91ec5482239 Martin Wilck     2018-04-18  148   * @n: parameter
dbef91ec5482239 Martin Wilck     2018-04-18  149   *
dbef91ec5482239 Martin Wilck     2018-04-18  150   * constant-capable log of base 2 calculation
dbef91ec5482239 Martin Wilck     2018-04-18  151   * - this can be used to initialise global variables from constant data, hence
dbef91ec5482239 Martin Wilck     2018-04-18  152   * the massive ternary operator construction
dbef91ec5482239 Martin Wilck     2018-04-18  153   *
dbef91ec5482239 Martin Wilck     2018-04-18  154   * selects the appropriately-sized optimised version depending on sizeof(n)
dbef91ec5482239 Martin Wilck     2018-04-18  155   */
dbef91ec5482239 Martin Wilck     2018-04-18  156  #define ilog2(n) \
dbef91ec5482239 Martin Wilck     2018-04-18  157  ( \
dbef91ec5482239 Martin Wilck     2018-04-18  158  	__builtin_constant_p(n) ?	\
2f78788b55baa34 Jakub Jelinek    2020-12-15  159  	((n) < 2 ? 0 :			\
2f78788b55baa34 Jakub Jelinek    2020-12-15  160  	 63 - __builtin_clzll(n)) :	\
f0d1b0b30d250a0 David Howells    2006-12-08  161  	(sizeof(n) <= 4) ?		\
f0d1b0b30d250a0 David Howells    2006-12-08  162  	__ilog2_u32(n) :		\
f0d1b0b30d250a0 David Howells    2006-12-08  163  	__ilog2_u64(n)			\
f0d1b0b30d250a0 David Howells    2006-12-08  164   )
f0d1b0b30d250a0 David Howells    2006-12-08  165  
312a0c170945b49 David Howells    2006-12-08  166  /**
312a0c170945b49 David Howells    2006-12-08  167   * roundup_pow_of_two - round the given value up to nearest power of two
a1c4d24e02d093e Randy Dunlap     2017-09-30  168   * @n: parameter
312a0c170945b49 David Howells    2006-12-08  169   *
6fb189c2a4f3bea Robert P. J. Day 2007-02-17  170   * round the given value up to the nearest power of two
312a0c170945b49 David Howells    2006-12-08  171   * - the result is undefined when n == 0
312a0c170945b49 David Howells    2006-12-08  172   * - this can be used to initialise global variables from constant data
312a0c170945b49 David Howells    2006-12-08  173   */
312a0c170945b49 David Howells    2006-12-08  174  #define roundup_pow_of_two(n)			\
312a0c170945b49 David Howells    2006-12-08  175  (						\
312a0c170945b49 David Howells    2006-12-08  176  	__builtin_constant_p(n) ? (		\
428fc0aff4e5939 Jason Gunthorpe  2020-09-04  177  		((n) == 1) ? 1 :		\
312a0c170945b49 David Howells    2006-12-08  178  		(1UL << (ilog2((n) - 1) + 1))	\
312a0c170945b49 David Howells    2006-12-08  179  				   ) :		\
312a0c170945b49 David Howells    2006-12-08  180  	__roundup_pow_of_two(n)			\
312a0c170945b49 David Howells    2006-12-08  181   )
312a0c170945b49 David Howells    2006-12-08  182  
b311e921b385b5a Robert P. J. Day 2007-10-16  183  /**
b311e921b385b5a Robert P. J. Day 2007-10-16  184   * rounddown_pow_of_two - round the given value down to nearest power of two
a1c4d24e02d093e Randy Dunlap     2017-09-30  185   * @n: parameter
b311e921b385b5a Robert P. J. Day 2007-10-16  186   *
b311e921b385b5a Robert P. J. Day 2007-10-16  187   * round the given value down to the nearest power of two
b311e921b385b5a Robert P. J. Day 2007-10-16  188   * - the result is undefined when n == 0
b311e921b385b5a Robert P. J. Day 2007-10-16  189   * - this can be used to initialise global variables from constant data
b311e921b385b5a Robert P. J. Day 2007-10-16  190   */
b311e921b385b5a Robert P. J. Day 2007-10-16  191  #define rounddown_pow_of_two(n)			\
b311e921b385b5a Robert P. J. Day 2007-10-16  192  (						\
b311e921b385b5a Robert P. J. Day 2007-10-16  193  	__builtin_constant_p(n) ? (		\
b311e921b385b5a Robert P. J. Day 2007-10-16 @194  		(1UL << ilog2(n))) :		\
b311e921b385b5a Robert P. J. Day 2007-10-16  195  	__rounddown_pow_of_two(n)		\
b311e921b385b5a Robert P. J. Day 2007-10-16  196   )
b311e921b385b5a Robert P. J. Day 2007-10-16  197  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]