Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1748120imm; Thu, 21 Jun 2018 01:32:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJQVQOnOtpidNB7UTQaWp0pWEOaziDvPyZ4V//LJt2FRklseApSiXYaQ0k0O5SeI1+3g/jH X-Received: by 2002:a63:8048:: with SMTP id j69-v6mr22018566pgd.429.1529569959426; Thu, 21 Jun 2018 01:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529569959; cv=none; d=google.com; s=arc-20160816; b=aBoDh56H95Ml2igExial8g9BIzqxZic4bmNGzE7E8HeGUYBwyP6aQgvwtq2yFft+tg 44SoSMMyfZagix9tBwduTJ9/JZMseB4OcLO7cRUfVbWYl7tnFP2Le+13p/0Iry6+Oo3U aXj48hTfl14DoZhvt1c9IIBaOnO2/LlnLyu1Toq6mcz46yiwgq8q27PLuanE91TCUFU/ zDp4gYAlPsd05ppKWCtE8lUuQXKpW5+Z5mpsYYeOXX7Ffssc1ddI6RHXL/+dfGGM5EGd JQOYyeizhPlKLewLtOzMfQbHiFDSfQJP2J8w9AsMYQ5+A0CjNAcSkSbFDybYepv/nDOp Ga7A== 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=JMf2A+z0K1VHI2UNixAkQreoCiwaBaW2SCx1ucwJ7FE=; b=V0NOCw2DpuRQsSxFRS7jT/NjIV7DH+XWBVFm7mzN4cYjc2/Do/vfE5i1mL7qfnaYvl GGyc/qV+7PEcjG4hG8ih4jG5AYLfGKB8vhB3TThJlYTvx9Ps+MPjSl7KQdUFrVS2Ckcm 7x9YVT3BF8Dquf/mE+V5xu4VIOexeiT+UdcFT889F6n5f1jE1kMI4Hyrv2qwSDA8oDs7 O5+uH0f5YO1w2vjllNQ5sAGqkZW+VoyOXa8QPXEwo45uWYvah75qnf9p7mkMpKe9WeWK qvzDiG5K5tPSQC9GVJXjgajRVpJnF3Eu4Szlv9+mCXL+oy3zeEt1yuX8WozTLIxv5vhV sWjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qsHDSpf/"; 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 j2-v6si3419221pgp.347.2018.06.21.01.31.54; Thu, 21 Jun 2018 01:32:39 -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="qsHDSpf/"; 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 S932827AbeFUI34 (ORCPT + 99 others); Thu, 21 Jun 2018 04:29:56 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:41412 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932466AbeFUI3y (ORCPT ); Thu, 21 Jun 2018 04:29:54 -0400 Received: by mail-pf0-f193.google.com with SMTP id a11-v6so1163478pff.8 for ; Thu, 21 Jun 2018 01:29:54 -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=JMf2A+z0K1VHI2UNixAkQreoCiwaBaW2SCx1ucwJ7FE=; b=qsHDSpf/eeOjrOmFWIyNf8JC0O3mU2Dd/pfaZR60xunlgP6wpXDn3XeqmyvQBwLRKv JFqaKcJqpQj5TjbTeorMC/qRZnpS7xVIbITnQ4kdk+frWVhfALiPI0Qt24F80/CmXdbt N/gjnFl/4z6lf1wxMI/uNFoRKjv8i6vEbyqKVyt5YAnvqze5nU15SODZD+Jh53QsSvpm k4DqZHCEA0axffogyrj3MK7IuMDxjWcr6PnDCfwxc16reC16AO329I9j+98JERXBxlty y3uky2N4RsOYyWcdYnaJ7KOWkDXLgUu1AFv6dvMT5+QyNpwDomSVl2oFvqEhgwDzpaXI 6s6A== 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=JMf2A+z0K1VHI2UNixAkQreoCiwaBaW2SCx1ucwJ7FE=; b=nP1TSay9+6xC8xE5fMRDrmvIqgcpAL7nFsCOJEPZdnQNlShAtqlHkIHXftsYkm2243 kx8JwsoEbmmq7PuZPesmEX6D5lh6g3W3YkIVosphrtsY+7QCblhAyzgYPSypulh2rsYx w4NHiC4x6hHKrx+czkSw8bWalK609/M7SxYWnDNyzd02A+UznHRnItlY3oZ4meuVxgea Bdo6FkpTc2SyNvXk21udaud7e7uBjuvZb+r4bNF0TjykpTlL1zfiItZuweuknR4WLDtX X3BiAqwCmTq53aJzf2lxikQTLcsZmPzBG8mCd6WWVTaD89Pbw/MHI+3IV7xtbYvplgmc MThA== X-Gm-Message-State: APt69E0KZvQpKRa3OGhmbApPW9wcfjEncduwaZbmmJIJh2mV4jJkyh9g OJgwPbkSBEI9xe116mGChjU= X-Received: by 2002:a65:4107:: with SMTP id w7-v6mr21018022pgp.90.1529569793872; Thu, 21 Jun 2018 01:29:53 -0700 (PDT) Received: from localhost ([39.7.59.103]) by smtp.gmail.com with ESMTPSA id x19-v6sm8488502pfi.5.2018.06.21.01.29.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Jun 2018 01:29:52 -0700 (PDT) Date: Thu, 21 Jun 2018 17:29:49 +0900 From: Sergey Senozhatsky To: Dmitry Vyukov Cc: Sergey Senozhatsky , Petr Mladek , Tetsuo Handa , Sergey Senozhatsky , syzkaller , Steven Rostedt , Fengguang Wu , LKML , Linus Torvalds , Andrew Morton Subject: Re: [PATCH] printk: inject caller information into the body of message Message-ID: <20180621082949.GB677@jagdpanzerIV> References: <20180524021451.GA23443@jagdpanzerIV> <20180620083126.GA477@jagdpanzerIV> <20180620090413.GA444@jagdpanzerIV> <20180620091541.GB444@jagdpanzerIV> <20180620110759.GD444@jagdpanzerIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 (06/20/18 13:32), Dmitry Vyukov wrote: > >> > >> So this is another reason to get rid of pr_cont entirely, right? > > > > Getting rid of pr_cont() from important output would be totally cool. > > Quoting Linus: > > > > Only acceptable use of continuations is basically boot-time testing, > > when you do things like > > > > printk("Testing feature XYZ.."); > > this_may_blow_up_because_of_hw_bugs(); > > printk(KERN_CONT " ... ok\n"); > > > > > > I can recall at least 4 attempts when people tried to introduce new pr_cont() > > or some concept with similar functionality to pr_cont(), but SMP safe. We > > brought the first one - per-CPU pr_cont() buffers - to KS several years ago > > but Linus didn't like it. Then there was a buffered printk() mode patch from > > Tetsuo, then a solution from Steven, then I had my second try with a > > soft-of-pr_cont() replacement. > > > > So, if we could get rid of pr_cont() from the most important parts > > (instruction dumps, etc) then I would just vote to leave pr_cont() > > alone and avoid any handling of it in printk context tracking. Simply > > because we wouldn't care about pr_cont(). This also could simplify > > Tetsuo's patch significantly. > > Sounds good to me. Another thing about pr_cont() is that as long as pr_cont() does not race with pr_cont() from another task or from IRQ, the task that is the owner (see struct cont in printk.c) of the existing continuation line can migrate, IOW we can have CPU0 CPU1 CPU2 CPU3 task A pr_cont() task A pr_cont() task A pr_cont() task A pr_cont("\n") << flush The line was printed from 4 CPUs, but appears as a single line in the logbuf. Should we account CPU0 or CPU3 as the line origin? That's another reason why I don't really want to handle pr_cont in any special way in context tracking. So, currently, context tracking looks like this: --- char mode = 'T'; if (in_serving_softirq()) mode = 'S'; if (in_irq()) mode = 'I'; if (in_nmi()) mode = 'N'; ret = snprintf(buf, buf_len, "%c<%d>%c", mode, raw_smp_processor_id(), cont.len ? '+' : ' '); --- I add a '+' symbol to continuation lines. Which should simply hint that tracking info for that particular line is not entirely trustworthy. I also don't add any tracking info for printk_safe output. We get tracking info for such lines from the printk_safe flush path (irq work that happens on the same CPU that added printk_safe output). -ss