Message ID | 20221114112842.38565-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,1/4] list: Introduce list_count() to count existing nodes | expand |
Hi Andy, I love your patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.1-rc5 next-20221114] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20221114112842.38565-1-andriy.shevchenko%40linux.intel.com patch subject: [PATCH v1 1/4] list: Introduce list_count() to count existing nodes config: x86_64-rhel-8.3-func compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/124813c325e31e99580c2aaef85bb3943e55c36e git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023 git checkout 124813c325e31e99580c2aaef85bb3943e55c36e # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/mutex.h:15, from include/linux/seq_file.h:9, from include/drm/drm_print.h:31, from drivers/gpu/drm/i915/gt/intel_engine_cs.c:8: >> include/linux/list.h:663:2: error: expected identifier or '(' before '{' token 663 | ({ \ | ^ drivers/gpu/drm/i915/gt/intel_engine_cs.c:2007:22: note: in expansion of macro 'list_count' 2007 | static unsigned long list_count(struct list_head *list) | ^~~~~~~~~~ vim +663 include/linux/list.h 557 558 /** 559 * list_next_entry - get the next element in list 560 * @pos: the type * to cursor 561 * @member: the name of the list_head within the struct. 562 */ 563 #define list_next_entry(pos, member) \ 564 list_entry((pos)->member.next, typeof(*(pos)), member) 565 566 /** 567 * list_next_entry_circular - get the next element in list 568 * @pos: the type * to cursor. 569 * @head: the list head to take the element from. 570 * @member: the name of the list_head within the struct. 571 * 572 * Wraparound if pos is the last element (return the first element). 573 * Note, that list is expected to be not empty. 574 */ 575 #define list_next_entry_circular(pos, head, member) \ 576 (list_is_last(&(pos)->member, head) ? \ 577 list_first_entry(head, typeof(*(pos)), member) : list_next_entry(pos, member)) 578 579 /** 580 * list_prev_entry - get the prev element in list 581 * @pos: the type * to cursor 582 * @member: the name of the list_head within the struct. 583 */ 584 #define list_prev_entry(pos, member) \ 585 list_entry((pos)->member.prev, typeof(*(pos)), member) 586 587 /** 588 * list_prev_entry_circular - get the prev element in list 589 * @pos: the type * to cursor. 590 * @head: the list head to take the element from. 591 * @member: the name of the list_head within the struct. 592 * 593 * Wraparound if pos is the first element (return the last element). 594 * Note, that list is expected to be not empty. 595 */ 596 #define list_prev_entry_circular(pos, head, member) \ 597 (list_is_first(&(pos)->member, head) ? \ 598 list_last_entry(head, typeof(*(pos)), member) : list_prev_entry(pos, member)) 599 600 /** 601 * list_for_each - iterate over a list 602 * @pos: the &struct list_head to use as a loop cursor. 603 * @head: the head for your list. 604 */ 605 #define list_for_each(pos, head) \ 606 for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) 607 608 /** 609 * list_for_each_rcu - Iterate over a list in an RCU-safe fashion 610 * @pos: the &struct list_head to use as a loop cursor. 611 * @head: the head for your list. 612 */ 613 #define list_for_each_rcu(pos, head) \ 614 for (pos = rcu_dereference((head)->next); \ 615 !list_is_head(pos, (head)); \ 616 pos = rcu_dereference(pos->next)) 617 618 /** 619 * list_for_each_continue - continue iteration over a list 620 * @pos: the &struct list_head to use as a loop cursor. 621 * @head: the head for your list. 622 * 623 * Continue to iterate over a list, continuing after the current position. 624 */ 625 #define list_for_each_continue(pos, head) \ 626 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next) 627 628 /** 629 * list_for_each_prev - iterate over a list backwards 630 * @pos: the &struct list_head to use as a loop cursor. 631 * @head: the head for your list. 632 */ 633 #define list_for_each_prev(pos, head) \ 634 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev) 635 636 /** 637 * list_for_each_safe - iterate over a list safe against removal of list entry 638 * @pos: the &struct list_head to use as a loop cursor. 639 * @n: another &struct list_head to use as temporary storage 640 * @head: the head for your list. 641 */ 642 #define list_for_each_safe(pos, n, head) \ 643 for (pos = (head)->next, n = pos->next; \ 644 !list_is_head(pos, (head)); \ 645 pos = n, n = pos->next) 646 647 /** 648 * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry 649 * @pos: the &struct list_head to use as a loop cursor. 650 * @n: another &struct list_head to use as temporary storage 651 * @head: the head for your list. 652 */ 653 #define list_for_each_prev_safe(pos, n, head) \ 654 for (pos = (head)->prev, n = pos->prev; \ 655 !list_is_head(pos, (head)); \ 656 pos = n, n = pos->prev) 657 658 /** 659 * list_count - count nodes in the list 660 * @head: the head for your list. 661 */ 662 #define list_count(head) \ > 663 ({ \ 664 struct list_head *__tmp; \ 665 size_t __i = 0; \ 666 list_for_each(__tmp, head) \ 667 __i++; \ 668 __i; \ 669 }) 670
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.1-rc5 next-20221114]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20221114112842.38565-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/4] list: Introduce list_count() to count existing nodes
config: i386-defconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/124813c325e31e99580c2aaef85bb3943e55c36e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023
git checkout 124813c325e31e99580c2aaef85bb3943e55c36e
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/mutex.h:15,
from include/linux/seq_file.h:9,
from include/drm/drm_print.h:31,
from drivers/gpu/drm/i915/gt/intel_engine_cs.c:8:
include/linux/list.h:663:2: error: expected identifier or '(' before '{' token
663 | ({ \
| ^
drivers/gpu/drm/i915/gt/intel_engine_cs.c:2007:22: note: in expansion of macro 'list_count'
2007 | static unsigned long list_count(struct list_head *list)
| ^~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_engine_cs.c: In function 'intel_engine_dump':
>> drivers/gpu/drm/i915/gt/intel_engine_cs.c:2192:38: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
2192 | drm_printf(m, "\tOn hold?: %lu\n",
| ~~^
| |
| long unsigned int
| %u
cc1: all warnings being treated as errors
vim +2192 drivers/gpu/drm/i915/gt/intel_engine_cs.c
dc0dad365c5ed8 drivers/gpu/drm/i915/gt/intel_engine_cs.c John Harrison 2021-07-26 2144
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2145 void intel_engine_dump(struct intel_engine_cs *engine,
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2146 struct drm_printer *m,
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2147 const char *header, ...)
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2148 {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2149 struct i915_gpu_error * const error = &engine->i915->gpu_error;
0212bdef5a4de3 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-15 2150 struct i915_request *rq;
538ef96b9dae7f drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-14 2151 intel_wakeref_t wakeref;
cfe7288c276e35 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-07-15 2152 unsigned long flags;
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2153 ktime_t dummy;
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2154
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2155 if (header) {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2156 va_list ap;
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2157
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2158 va_start(ap, header);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2159 drm_vprintf(m, header, &ap);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2160 va_end(ap);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2161 }
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2162
cb823ed9915b0d drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-07-12 2163 if (intel_gt_is_wedged(engine->gt))
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2164 drm_printf(m, "*** WEDGED ***\n");
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2165
79ffac8599c4d8 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-04-24 2166 drm_printf(m, "\tAwake? %d\n", atomic_read(&engine->wakeref.count));
7983990ca94ab6 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-11-28 2167 drm_printf(m, "\tBarriers?: %s\n",
01fabda8e3d62e drivers/gpu/drm/i915/gt/intel_engine_cs.c Lucas De Marchi 2022-02-25 2168 str_yes_no(!llist_empty(&engine->barrier_tasks)));
b81e4d9b594188 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-12-19 2169 drm_printf(m, "\tLatency: %luus\n",
b81e4d9b594188 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-12-19 2170 ewma__engine_latency_read(&engine->latency));
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2171 if (intel_engine_supports_stats(engine))
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2172 drm_printf(m, "\tRuntime: %llums\n",
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2173 ktime_to_ms(intel_engine_get_busy_time(engine,
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2174 &dummy)));
ac4fc5b38d1abc drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-05 2175 drm_printf(m, "\tForcewake: %x domains, %d active\n",
2c421896adb099 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2021-01-15 2176 engine->fw_domain, READ_ONCE(engine->fw_active));
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2177
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2178 rcu_read_lock();
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2179 rq = READ_ONCE(engine->heartbeat.systole);
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2180 if (rq)
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2181 drm_printf(m, "\tHeartbeat: %d ms ago\n",
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2182 jiffies_to_msecs(jiffies - rq->emitted_jiffies));
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2183 rcu_read_unlock();
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2184 drm_printf(m, "\tReset count: %d (global %d)\n",
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2185 i915_reset_engine_count(error, engine),
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2186 i915_reset_count(error));
0bda4b80d949d8 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-09-16 2187 print_properties(engine, m);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2188
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 2189 spin_lock_irqsave(&engine->sched_engine->lock, flags);
dc0dad365c5ed8 drivers/gpu/drm/i915/gt/intel_engine_cs.c John Harrison 2021-07-26 2190 engine_dump_active_requests(engine, m);
83c317832eb186 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-06-14 2191
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 @2192 drm_printf(m, "\tOn hold?: %lu\n",
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 2193 list_count(&engine->sched_engine->hold));
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 2194 spin_unlock_irqrestore(&engine->sched_engine->lock, flags);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2195
a4eb99a1d61754 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-08-13 2196 drm_printf(m, "\tMMIO base: 0x%08x\n", engine->mmio_base);
cd6a851385be87 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-07 2197 wakeref = intel_runtime_pm_get_if_in_use(engine->uncore->rpm);
538ef96b9dae7f drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-14 2198 if (wakeref) {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2199 intel_engine_print_registers(engine, m);
cd6a851385be87 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-07 2200 intel_runtime_pm_put(engine->uncore->rpm, wakeref);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2201 } else {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2202 drm_printf(m, "\tDevice is asleep; skipping register dump\n");
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2203 }
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2204
1f0e785a9cc09b drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-11-19 2205 intel_execlists_show_requests(engine, m, i915_request_show, 8);
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2206
c1bf272857896d drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-12-22 2207 drm_printf(m, "HWSP:\n");
0ca88ba0d6347c drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-28 2208 hexdump(m, engine->status_page.addr, PAGE_SIZE);
c1bf272857896d drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-12-22 2209
01fabda8e3d62e drivers/gpu/drm/i915/gt/intel_engine_cs.c Lucas De Marchi 2022-02-25 2210 drm_printf(m, "Idle? %s\n", str_yes_no(intel_engine_is_idle(engine)));
52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 2211
52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 2212 intel_engine_print_breadcrumbs(engine, m);
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2213 }
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2214
On Mon, Nov 14, 2022 at 11:38:04PM +0800, kernel test robot wrote: > Hi Andy, > > I love your patch! Yet something to improve: > > [auto build test ERROR on usb/usb-testing] > [also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.1-rc5 next-20221114] > [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#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023 > base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing > patch link: https://lore.kernel.org/r/20221114112842.38565-1-andriy.shevchenko%40linux.intel.com > patch subject: [PATCH v1 1/4] list: Introduce list_count() to count existing nodes > config: x86_64-rhel-8.3-func > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 > reproduce (this is a W=1 build): > # https://github.com/intel-lab-lkp/linux/commit/124813c325e31e99580c2aaef85bb3943e55c36e > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023 > git checkout 124813c325e31e99580c2aaef85bb3943e55c36e > # save the config file > mkdir build_dir && cp config build_dir/.config > make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/ > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot <lkp@intel.com> > > All errors (new ones prefixed by >>): Oh, nice! I will fix this for v2.
On Mon, Nov 14, 2022 at 06:03:00PM +0200, Andy Shevchenko wrote:
> Oh, nice! I will fix this for v2.
list_count() is an antipattern. I don't have any of the patches in
my inbox, so maybe there's a great reason for doing this, but my
immediate response is: NAK.
On Mon, Nov 14, 2022 at 05:47:21PM +0000, Matthew Wilcox wrote: > On Mon, Nov 14, 2022 at 06:03:00PM +0200, Andy Shevchenko wrote: > > Oh, nice! I will fix this for v2. > > list_count() is an antipattern. I don't have any of the patches in > my inbox, so maybe there's a great reason for doing this, but my > immediate response is: NAK. When we are trying to hide iterator variable in many cases, leaving the current code alive will allow explicit access to it. If it's not a problem, why to bother with the other list APIs then?
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus linus/master v6.1-rc5 next-20221114]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20221114112842.38565-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/4] list: Introduce list_count() to count existing nodes
config: i386-randconfig-a012-20221114
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/124813c325e31e99580c2aaef85bb3943e55c36e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/list-Introduce-list_count-to-count-existing-nodes/20221114-193023
git checkout 124813c325e31e99580c2aaef85bb3943e55c36e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/i915/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/gpu/drm/i915/gt/intel_engine_cs.c:2007:22: error: expected identifier or '('
static unsigned long list_count(struct list_head *list)
^
include/linux/list.h:663:2: note: expanded from macro 'list_count'
({ \
^
drivers/gpu/drm/i915/gt/intel_engine_cs.c:2007:22: error: expected ')'
include/linux/list.h:663:2: note: expanded from macro 'list_count'
({ \
^
drivers/gpu/drm/i915/gt/intel_engine_cs.c:2007:22: note: to match this '('
include/linux/list.h:662:27: note: expanded from macro 'list_count'
#define list_count(head) \
^
>> drivers/gpu/drm/i915/gt/intel_engine_cs.c:2193:6: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
list_count(&engine->sched_engine->hold));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:662:27: note: expanded from macro 'list_count'
#define list_count(head) \
^
1 warning and 2 errors generated.
vim +2193 drivers/gpu/drm/i915/gt/intel_engine_cs.c
dc0dad365c5ed8 drivers/gpu/drm/i915/gt/intel_engine_cs.c John Harrison 2021-07-26 2144
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2145 void intel_engine_dump(struct intel_engine_cs *engine,
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2146 struct drm_printer *m,
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2147 const char *header, ...)
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2148 {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2149 struct i915_gpu_error * const error = &engine->i915->gpu_error;
0212bdef5a4de3 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-15 2150 struct i915_request *rq;
538ef96b9dae7f drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-14 2151 intel_wakeref_t wakeref;
cfe7288c276e35 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-07-15 2152 unsigned long flags;
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2153 ktime_t dummy;
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2154
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2155 if (header) {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2156 va_list ap;
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2157
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2158 va_start(ap, header);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2159 drm_vprintf(m, header, &ap);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2160 va_end(ap);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2161 }
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2162
cb823ed9915b0d drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-07-12 2163 if (intel_gt_is_wedged(engine->gt))
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2164 drm_printf(m, "*** WEDGED ***\n");
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2165
79ffac8599c4d8 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-04-24 2166 drm_printf(m, "\tAwake? %d\n", atomic_read(&engine->wakeref.count));
7983990ca94ab6 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-11-28 2167 drm_printf(m, "\tBarriers?: %s\n",
01fabda8e3d62e drivers/gpu/drm/i915/gt/intel_engine_cs.c Lucas De Marchi 2022-02-25 2168 str_yes_no(!llist_empty(&engine->barrier_tasks)));
b81e4d9b594188 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-12-19 2169 drm_printf(m, "\tLatency: %luus\n",
b81e4d9b594188 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-12-19 2170 ewma__engine_latency_read(&engine->latency));
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2171 if (intel_engine_supports_stats(engine))
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2172 drm_printf(m, "\tRuntime: %llums\n",
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2173 ktime_to_ms(intel_engine_get_busy_time(engine,
4fb33953438bf3 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-19 2174 &dummy)));
ac4fc5b38d1abc drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-06-05 2175 drm_printf(m, "\tForcewake: %x domains, %d active\n",
2c421896adb099 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2021-01-15 2176 engine->fw_domain, READ_ONCE(engine->fw_active));
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2177
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2178 rcu_read_lock();
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2179 rq = READ_ONCE(engine->heartbeat.systole);
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2180 if (rq)
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2181 drm_printf(m, "\tHeartbeat: %d ms ago\n",
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2182 jiffies_to_msecs(jiffies - rq->emitted_jiffies));
058179e72e0956 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-23 2183 rcu_read_unlock();
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2184 drm_printf(m, "\tReset count: %d (global %d)\n",
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2185 i915_reset_engine_count(error, engine),
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2186 i915_reset_count(error));
0bda4b80d949d8 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-09-16 2187 print_properties(engine, m);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2188
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 2189 spin_lock_irqsave(&engine->sched_engine->lock, flags);
dc0dad365c5ed8 drivers/gpu/drm/i915/gt/intel_engine_cs.c John Harrison 2021-07-26 2190 engine_dump_active_requests(engine, m);
83c317832eb186 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-06-14 2191
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 2192 drm_printf(m, "\tOn hold?: %lu\n",
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 @2193 list_count(&engine->sched_engine->hold));
349a2bc5aae45f drivers/gpu/drm/i915/gt/intel_engine_cs.c Matthew Brost 2021-06-17 2194 spin_unlock_irqrestore(&engine->sched_engine->lock, flags);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2195
a4eb99a1d61754 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-08-13 2196 drm_printf(m, "\tMMIO base: 0x%08x\n", engine->mmio_base);
cd6a851385be87 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-07 2197 wakeref = intel_runtime_pm_get_if_in_use(engine->uncore->rpm);
538ef96b9dae7f drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-14 2198 if (wakeref) {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2199 intel_engine_print_registers(engine, m);
cd6a851385be87 drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2019-10-07 2200 intel_runtime_pm_put(engine->uncore->rpm, wakeref);
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2201 } else {
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2202 drm_printf(m, "\tDevice is asleep; skipping register dump\n");
3ceda3a4a85633 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2018-02-12 2203 }
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2204
1f0e785a9cc09b drivers/gpu/drm/i915/gt/intel_engine_cs.c Chris Wilson 2020-11-19 2205 intel_execlists_show_requests(engine, m, i915_request_show, 8);
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2206
c1bf272857896d drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-12-22 2207 drm_printf(m, "HWSP:\n");
0ca88ba0d6347c drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-28 2208 hexdump(m, engine->status_page.addr, PAGE_SIZE);
c1bf272857896d drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-12-22 2209
01fabda8e3d62e drivers/gpu/drm/i915/gt/intel_engine_cs.c Lucas De Marchi 2022-02-25 2210 drm_printf(m, "Idle? %s\n", str_yes_no(intel_engine_is_idle(engine)));
52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 2211
52c0fdb25c7c91 drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2019-01-29 2212 intel_engine_print_breadcrumbs(engine, m);
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2213 }
f636edb214a5ff drivers/gpu/drm/i915/intel_engine_cs.c Chris Wilson 2017-10-09 2214
diff --git a/include/linux/list.h b/include/linux/list.h index 61762054b4be..098eccf8c1b6 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -655,6 +655,19 @@ static inline void list_splice_tail_init(struct list_head *list, !list_is_head(pos, (head)); \ pos = n, n = pos->prev) +/** + * list_count - count nodes in the list + * @head: the head for your list. + */ +#define list_count(head) \ +({ \ + struct list_head *__tmp; \ + size_t __i = 0; \ + list_for_each(__tmp, head) \ + __i++; \ + __i; \ +}) + /** * list_entry_is_head - test if the entry points to the head of the list * @pos: the type * to cursor
Some of the existing users, and definitely will be new ones, want to count existing nodes in the list. Provide a generic API for that. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- include/linux/list.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)