#!/usr/bin/python # # show_deltas: Read list of printk messages instrumented with # time data, and format with time deltas. # # Also, you can show the times relative to a fixed point. # # Copyright 2003 Sony Corporation # # GPL 2.0 applies. import sys import string def usage(): print ("""usage: show_delta [] This program parses the output from a set of printk message lines which have time data prefixed because the CONFIG_PRINTK_TIME option is set, or the kernel command line option "time" is specified. When run with no options, the time information is converted to show the time delta between each printk line and the next. When run with the '-b' option, all times are relative to a single (base) point in time. Options: -h Show this usage help. -b Specify a base for time references. can be a number or a string. If it is a string, the first message line which matches (at the beginning of the line) is used as the time reference. ex: $ dmesg >timefile $ show_delta -b NET4 timefile will show times relative to the line in the kernel output starting with "NET4". """) sys.exit(1) # returns a tuple containing the seconds and text for each message line # seconds is returned as a float # raise an exception if no timing data was found def get_time(line): if line[0]!="[": raise ValueError # split on closing bracket (time_str, rest) = string.split(line[1:],']',1) time = string.atof(time_str) #print "time=", time return (time, rest) # average line looks like: # [ 0.084282] VFS: Mounted root (romfs filesystem) readonly # time data is expressed in seconds.useconds, # convert_line adds a delta for each line last_time = 0.0 def convert_line(line, base_time): global last_time try: (time, rest) = get_time(line) except: # if any problem parsing time, don't convert anything return line if base_time: # show time from base delta = time - base_time else: # just show time from last line delta = time - last_time last_time = time return ("[%5.6f < %5.6f >]" % (time, delta)) + rest def main(): base_str = "" filein = "" for arg in sys.argv[1:]: if arg=="-b": base_str = sys.argv[sys.argv.index("-b")+1] elif arg=="-h": usage() else: filein = arg if not filein: usage() try: lines = open(filein,"r").readlines() except: print ("Problem opening file: %s" % filein) sys.exit(1) if base_str: print ('base= "%s"' % base_str) # assume a numeric base. If that fails, try searching # for a matching line. try: base_time = float(base_str) except: # search for line matching string found = 0 for line in lines: try: (time, rest) = get_time(line) except: continue if string.find(rest, base_str)==1: base_time = time found = 1 # stop at first match break if not found: print ('Couldn\'t find line matching base pattern "%s"' % base_str) sys.exit(1) else: base_time = 0.0 for line in lines: print (convert_line(line, base_time),) main() ='this.form.submit();'>space:mode:
authorAndrei Vagin <avagin@openvz.org>2017-01-04 19:28:14 -0800
committerEric W. Biederman <ebiederm@xmission.com>2017-01-10 13:34:56 +1300
commitadd7c65ca426b7a37184dd3d2172394e23d585d6 (patch)
tree28b08b519540041b06ed0ab0b1c005076b932e8e
parent75422726b0f717d67db3283c2eb5bc14fa2619c5 (diff)
pid: fix lockdep deadlock warning due to ucount_lock
========================================================= [ INFO: possible irq lock inversion dependency detected ] 4.10.0-rc2-00024-g4aecec9-dirty #118 Tainted: G W --------------------------------------------------------- swapper/1/0 just changed the state of lock: (&(&sighand->siglock)->rlock){-.....}, at: [<ffffffffbd0a1bc6>] __lock_task_sighand+0xb6/0x2c0 but this lock took another, HARDIRQ-unsafe lock in the past: (ucounts_lock){+.+...} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Chain exists of: &(&sighand->siglock)->rlock --> &(&tty->ctrl_lock)->rlock --> ucounts_lock Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ucounts_lock); local_irq_disable(); lock(&(&sighand->siglock)->rlock); lock(&(&tty->ctrl_lock)->rlock); <Interrupt> lock(&(&sighand->siglock)->rlock); *** DEADLOCK *** This patch removes a dependency between rlock and ucount_lock. Fixes: f333c700c610 ("pidns: Add a limit on the number of pid namespaces") Cc: stable@vger.kernel.org Signed-off-by: Andrei Vagin <avagin@openvz.org> Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>