From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F999CA9EB5 for ; Mon, 21 Oct 2019 09:09:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6781620873 for ; Mon, 21 Oct 2019 09:09:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6781620873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 00F1E6B0003; Mon, 21 Oct 2019 05:09:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F01316B0005; Mon, 21 Oct 2019 05:09:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3D496B0006; Mon, 21 Oct 2019 05:09:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id C2FBE6B0003 for ; Mon, 21 Oct 2019 05:09:28 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 5BC128249980 for ; Mon, 21 Oct 2019 09:09:28 +0000 (UTC) X-FDA: 76067218416.27.tail84_8cdd3cbb3a73e X-HE-Tag: tail84_8cdd3cbb3a73e X-Filterd-Recvd-Size: 2355 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Oct 2019 09:09:27 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 18D67B879; Mon, 21 Oct 2019 09:09:26 +0000 (UTC) Date: Mon, 21 Oct 2019 11:09:25 +0200 From: Petr Mladek To: glider@google.com Cc: Vegard Nossum , Sergey Senozhatsky , Steven Rostedt , Dmitry Vyukov , linux-mm@kvack.org Subject: Re: [PATCH RFC v1 05/26] printk_safe: externalize printk_context Message-ID: <20191021090925.3dcqukovauqsyw5w@pathway.suse.cz> References:<20191018094304.37056-1-glider@google.com> <20191018094304.37056-6-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To:<20191018094304.37056-6-glider@google.com> User-Agent: NeoMutt/20170912 (1.9.0) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 2019-10-18 11:42:43, glider@google.com wrote: > Petr Mladek suggested we use > this_cpu_read(printk_context) & PRINTK_SAFE_CONTEXT_MASK > instead of checking the spinlock status in kmsan_pr_err() I would like to understand why the check is needed. My guess is that it prevents a infinite recursion. Is this the case? It might be possible to debug this using trace_printk(). It is important. If it is the recursion then there are two possibilities how to prevent it. Either prevent calling the recursive printk(). Or prevent calling the memory checker recursive. I am not sure what makes more sense. Is printk() the only piece of code where you need to avoid recursion? I wonder how it is prevented in the other cases. > This appears to be less intrusive, although we'll need to declare > printk_context in some printk header. It is easier than the original approach. But the main motivation is that it is more reliable. The spinlock is a global lock. But it seems that it is enough to check the state of the local CPU. Finally, could you please CC me to the patch(es) that are using this variable? I would actually prefer to be in CC of entire patchsets so that I see the full context. Best Regards, Petr