Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1556726imm; Wed, 23 May 2018 19:16:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr8oMYNUQomVCahqSKjnK7Fp75LXozMoWhlPN0nu2PZmqp44eVQkPUbCElfpYA2SQXdFqOI X-Received: by 2002:a65:6557:: with SMTP id a23-v6mr4151157pgw.319.1527128191983; Wed, 23 May 2018 19:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527128191; cv=none; d=google.com; s=arc-20160816; b=bYKT8g1VpRBMLHI+Q+rOwPfzECrnh7VSVR5lqPbcTsjn1YQhDVciH7vzmYxE7oxMk1 oplIAq99Sa53Yq1fncBxNeIbrlNneQVXWyg6JvG/aGMC4i6iGdpi9l2EiQGlaKk4r2t7 rCb1uLtri2CIj+OhTjyS5c/w7WpwORQ9t49jMJ4ZUxj+CKuX9EMPlLYPGR7HdjMMQ/mf WgtoeTJEKELminMCBPbInbVca+ECMYfT0q9si0gb32jY5gF0K6401CvNPgArjbW20c3n FGEJvJ+/4BVAh9VqNMhwWu5En0DK4TwTsUYFyIPLtrPOY+BsSQDTSMFq/euZzVW618rZ J8ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=athhXJziNm/yvfzEFbcXXSDXpHYw9ov2divoxcZa2EU=; b=IBP5Ybo4FytL2L0tDDNHx/ua7uX1mA9gJ8m02bLPJr8vM8S7UrCI1EXnSKBNIvDYrZ NHRcNL0hpvzybjD6GJjQ14BK3HVlk9z/l0/UdWb2yNUTaGt7elxkpWJe4vtLHA8uVvL7 MOJrlKzF1Nm2JW7+lQVL2t+yX80mioLFk+5vkz60KT9ojs0vEFExHSAeG10Y7akdZvRv QmXyehDdq+F82bUSDLQwWZpONHWD+LfwoepZ67tpSVY8RoAFhWYZgvA+8yN/TwXSE/kC yNE9ESD4NSniZI08+eWBn4XRvEOqyeep5CUu6iXa9iOLSAgxfejdIw+a0SsR4EyWiD1m sEWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eZVCSnIn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a92-v6si20316827pla.291.2018.05.23.19.16.17; Wed, 23 May 2018 19:16:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eZVCSnIn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935545AbeEXCO7 (ORCPT + 99 others); Wed, 23 May 2018 22:14:59 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37414 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935126AbeEXCO4 (ORCPT ); Wed, 23 May 2018 22:14:56 -0400 Received: by mail-pf0-f194.google.com with SMTP id e9-v6so40508pfi.4 for ; Wed, 23 May 2018 19:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=athhXJziNm/yvfzEFbcXXSDXpHYw9ov2divoxcZa2EU=; b=eZVCSnInTr+HWab/dpCwr5Gkbk2BGGWA/v9y6wG4deL2bpFEFUJLl/D1FZqkgrCVmd CYKKYh9EVAN+202+Iz31Magm+2usM4ufDu/jVGm2FOm4c3HdHW6kcfTCOtOjUP06L2yu 0Uo+/ho+Go+gxpWJjzqc6+616u1dOBLima5wqmd+ytcrxqzY6Xeeh5CsyT27A9fseKqK 3VcGqe2s5X/nY4yfhcu7Ry+/Lkn45fmQ3neFcjNDCVJ2YMaZYT0DOg2AWzzDqE9tOSbb A5hx6aNHlfkeohuAhnFNWg8gPCkPxM8nfW7a08R7rG6mcM+WseV/0FqRhZI5+DRpBItG 8fDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=athhXJziNm/yvfzEFbcXXSDXpHYw9ov2divoxcZa2EU=; b=Q7Z7tj5wuYtpMpvF9CY0zU8fdbAxV6znj0fmoBbyK62d/Ahro5mwz+8r1CsXotVlHi Yelcb3ug4HRSwiLC8CRK7jNKdLVngtGtjVdYk4OwdCUHiX7b0qlg2/T+kotgKHfwL91d ow8Kgcdz0WqSXisVukbIG47tN2jnqe97mYOd4w8ep7gcNuYGFIBsWTyRN/KjTQiyMgSo Xrk/7Ufro5uLHaOk/KoR5jlXeBahPkuOgj+SGccIjN6wVPZyjAy4X0ImVsOwQwFllrsU FRCtNKKd32e+jeNJxES56P4pMlte6DRcDKpV0/92d7ZLU1KERAP6SLbAn5bPwKoxbiuR OtDw== X-Gm-Message-State: ALKqPwci3bVkz4d8GHozchkFrJKGpR3/aXguqwetdCPYimR62O/xUjtl SWpbocN/o5F4Kl1hSkgsI2Q= X-Received: by 2002:a62:f58b:: with SMTP id b11-v6mr5212170pfm.113.1527128096025; Wed, 23 May 2018 19:14:56 -0700 (PDT) Received: from localhost ([175.223.44.136]) by smtp.gmail.com with ESMTPSA id h75-v6sm39350601pfh.148.2018.05.23.19.14.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 19:14:54 -0700 (PDT) Date: Thu, 24 May 2018 11:14:51 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Tetsuo Handa , Sergey Senozhatsky , dvyukov@google.com, sergey.senozhatsky@gmail.com, syzkaller@googlegroups.com, rostedt@goodmis.org, fengguang.wu@intel.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org Subject: Re: [PATCH] printk: inject caller information into the body of message Message-ID: <20180524021451.GA23443@jagdpanzerIV> References: <20180511014515.GA895@jagdpanzerIV> <201805110238.w4B2cIGH079602@www262.sakura.ne.jp> <20180511062151.GA18160@jagdpanzerIV> <20180511095004.GA6575@jagdpanzerIV> <201805112058.AAB05258.HJQFFOMFOVtOSL@I-love.SAKURA.ne.jp> <20180517112135.GB20796@jagdpanzerIV> <20180518121506.wilixxkznbtskw34@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518121506.wilixxkznbtskw34@pathway.suse.cz> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (05/18/18 14:15), Petr Mladek wrote: > > Dunno... > > For instance, can we store context tracking info as a extended record > > data? We have that dict/dict_len thing. So may we can store tracking > > info there? Extended records will appear on the serial console /* if > > console supports extended data */ or can be read in via devkmsg_read(). > > Any other options? > > This sounds interesting. Well, we would need to handle different dict > items different ways. I still wonder if we really need these "hacks". Well, it doesn't look like a complete hack. Extended records are there exactly for the "this printk line came from context (device, subsystem) ABC" type of thing. Those entries are multi-key/value already, we just can add one more key/value pair. E.g. appending CONTEXT to already existing SUBSYSTEM/DEVICE lines: 6,575,3130042,-;snd_hda_codec_generic hdaudioC1D0: dig-out=0x4/0x5 CONTEXT=4/99 PREEMPT=0/0/0/0 SUBSYSTEM=hdaudio DEVICE=+hdaudio:hdaudioC1D But I'm not pushing for this particular solution. It just looked reasonable and very "cheap", as we don't break anything. > > IMHO, we could change struct printk_log if we provide related > patches for crashdump and crash utilities. Yep. > First, we should ask what we expect from this feature. Yeah. Can't really comment on this, it's up to Tetsuo and Dmitry to decide. So far I've seen slightly different requirements/expectations. > Different information might be needed in different situations. > In general, people might want to know: > > + CPUid even in task context > + exact interrupt context (soft, hard, NMI) Agreed. > + whether preemption or interrupts are enabled preemption and irqs are already disabled this far in printk() internals. > It still looks bearable. But what if people want more, > e.g. context switch counts, task state, pending signals, > mem usage, cgroup stuff. Right. Extended records [dicts] can be up to 8k each, so I'd say that we can have as many key/value pairs as we want to. > Is this information useful for all messages or only > selected ones? No idea :) > Is it acceptable when message prefix is longer than, let's > say 40 characters? If we talk about embedding this info into normal message payload then, yes, we better keep it as small as possible. Because we are limited by LOG_LINE_MAX + PREFIX_MAX chars [~1024 bytes, if I recall correctly], the more we steal for context info the less we have for the message. > Is the extended output worth having even on slow consoles? My expectation was that syzkaller is mostly executed in qemu environment. But if someone would want to run it on a device with a slow console, then it might be painful. > By other words, I wonder if you wanted similar feature in many > situations in the past and could provide more use cases. Sorry, can you explain a bit more? > Note: > > The proposed patch enabled the extra info with a config option > => you need to rebuild the kernel => you could just modify > the problematic message. We could just add some printk_ helpers > to make it easier. Yes. As far as I know syzkaller folks are completely fine with the .config based solution and can rebuild the kernel as many times as needed, modifying the kernel code, at the same time, is not an option. > Alternatively, I wonder if it might be enough to add a tracepoint > into printk() and get the extra info via > /sys/kernel/debug/tracing/events/. Sounds good to me. > We would need to prevent recursion when trace buffer is flushed by > printk() but... Agreed. -ss