linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace
@ 2020-05-19 17:29 Joe Perches
  2020-05-19 23:56 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2020-05-19 17:29 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Dmitry Vyukov, LKML, Andrew Morton, Will Deacon

This code that uses the printk return value in
kernel/locking/lockdep.c is odd because the printk
return value includes both the length of a KERN_<LEVEL>
prefix and a newline.  depth is also double counted.

Change the code to calculate depth + 3 + strlen.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/locking/lockdep.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 2fadc2635946..265227edc550 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1960,11 +1960,9 @@ static void print_lock_class_header(struct lock_class *class, int depth)
 
 	for (bit = 0; bit < LOCK_USAGE_STATES; bit++) {
 		if (class->usage_mask & (1 << bit)) {
-			int len = depth;
-
-			len += printk("%*s   %s", depth, "", usage_str[bit]);
-			len += printk(KERN_CONT " at:\n");
-			print_lock_trace(class->usage_traces[bit], len);
+			printk("%*s   %s at:\n", depth, "", usage_str[bit]);
+			print_lock_trace(class->usage_traces[bit],
+					 depth + 3 + strlen(usage_str[bit]);
 		}
 	}
 	printk("%*s }\n", depth, "");




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace
  2020-05-19 17:29 [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace Joe Perches
@ 2020-05-19 23:56 ` kbuild test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2020-05-19 23:56 UTC (permalink / raw)
  To: Joe Perches, Peter Zijlstra
  Cc: kbuild-all, clang-built-linux, Dmitry Vyukov, LKML,
	Andrew Morton, Linux Memory Management List, Will Deacon

[-- Attachment #1: Type: text/plain, Size: 2791 bytes --]

Hi Joe,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/locking/core]
[also build test ERROR on v5.7-rc6 next-20200519]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Joe-Perches/lockdep-Use-different-indentation-in-print_lock_class_header-print_lock_trace/20200520-013024
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 23b5ae2e8e1326c91b5dfdbb6ebcd5a6820074ae
config: arm-randconfig-r002-20200519 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

kernel//locking/lockdep.c:687:4: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
class->wait_type_outer ?: class->wait_type_inner,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel//locking/lockdep.c:1965:41: error: expected ')'
depth + 3 + strlen(usage_str[bit]);
^
kernel//locking/lockdep.c:1964:20: note: to match this '('
print_lock_trace(class->usage_traces[bit],
^
1 warning and 1 error generated.

vim +1965 kernel//locking/lockdep.c

  1949	
  1950	static void print_lock_class_header(struct lock_class *class, int depth)
  1951	{
  1952		int bit;
  1953	
  1954		printk("%*s->", depth, "");
  1955		print_lock_name(class);
  1956	#ifdef CONFIG_DEBUG_LOCKDEP
  1957		printk(KERN_CONT " ops: %lu", debug_class_ops_read(class));
  1958	#endif
  1959		printk(KERN_CONT " {\n");
  1960	
  1961		for (bit = 0; bit < LOCK_USAGE_STATES; bit++) {
  1962			if (class->usage_mask & (1 << bit)) {
  1963				printk("%*s   %s at:\n", depth, "", usage_str[bit]);
  1964				print_lock_trace(class->usage_traces[bit],
> 1965						 depth + 3 + strlen(usage_str[bit]);
  1966			}
  1967		}
  1968		printk("%*s }\n", depth, "");
  1969	
  1970		printk("%*s ... key      at: [<%px>] %pS\n",
  1971			depth, "", class->key, class->key);
  1972	}
  1973	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26677 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-19 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 17:29 [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace Joe Perches
2020-05-19 23:56 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).