Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp363616imm; Fri, 1 Jun 2018 02:10:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ+0v5RHbWWACnExI4nB9cAGwPh5jE4/KoqNOtwWseR6AAdee+wh2ByMNgV2J7/40rhDUtd X-Received: by 2002:a17:902:42c3:: with SMTP id h61-v6mr10339558pld.164.1527844230221; Fri, 01 Jun 2018 02:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527844230; cv=none; d=google.com; s=arc-20160816; b=Vg0AyGnQNj7YjPSg6w7ky3pEW/RxL0rfllzQMkqLU/gdrvHnItEIndQ8nSMyXtilYe gqWC4Mg4YTfrmZcDyDA+qxrx3bDzoC+aCGUEuSli7orO9LUtX56oy11KvbTa9cQ4OwcO zWZwMR+fmsnO2mhndDjEmcGTY5QvRFF0IwUwpRB2A7kn8eMw8lm4IPgkcjqbzTE+6tRG AL4ZzZm/N7UspkmRtk5uk5ficxbEfnM/iRUoluHTuPfBLkBPd0TwubBZFGcNVHXhv3Wk BJXgG16GZHL3da8BdZ9xlOvkpwFmclPuwt9+xmR1meETJGCw2wUaI8xlLi1Oxz/fKc13 07Fg== 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:arc-authentication-results; bh=AO9FRbH2MmxeytB21486yApjojzu8OuHrzz4RGihA5o=; b=HjndU8C9wbqM2vrj5jCLqYQkgB1/j+SOqYou5qt97/5B1JdoqNlvNJio6JtuR7aT0m Vj79ZspWscdg/NxzNudHe7e6ZQvow0u0VEyZ9ttAbXQdUHsWL1qLXdc4G6YnPYkraCjh 8+dzx3zjCHB5MV0dsB3G0Vq/iDV0XODT+lnAMsmuCUvS8ik0cduGBPoeSIVnKxR/ZVA7 GxKoaMlIPEfUiY9whP6uWBGOf9hlvZCTkTuEWJTdW2059HPgulBvcW8Ntnvb1sHFwTDP UrXTZQn6Xip12+QJCfnD/JlQCDfePuX0Me6rd52F5vN4c+E+MPAq5tEb/HfEqASZ8KjH 7O1w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11-v6si21474356plt.39.2018.06.01.02.10.15; Fri, 01 Jun 2018 02:10:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750795AbeFAJJu (ORCPT + 99 others); Fri, 1 Jun 2018 05:09:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:54846 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750718AbeFAJJo (ORCPT ); Fri, 1 Jun 2018 05:09:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B8132AEF2; Fri, 1 Jun 2018 09:09:43 +0000 (UTC) Date: Fri, 1 Jun 2018 11:09:42 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Maninder Singh , sergey.senozhatsky@gmail.com, rostedt@goodmis.org, linux-kernel@vger.kernel.org, a.sahrawat@samsung.com, pankaj.m@samsung.com, v.narang@samsung.com Subject: Re: [PATCH 2/2] printk: make sure to print log on console. Message-ID: <20180601090942.ek3j4bpbhschljrw@pathway.suse.cz> References: <20180531102246epcas5p2f1cbc6ff217172e12e2f78bb88eb4a7e~zs5h59tMh2250222502epcas5p2S@epcas5p2.samsung.com> <20180531105215.GF477@jagdpanzerIV> <20180531122112.bfeqtmwpl2qc67a5@pathway.suse.cz> <20180601044050.GA5687@jagdpanzerIV> <20180601085356.kncuat7epkbtythv@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180601085356.kncuat7epkbtythv@pathway.suse.cz> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2018-06-01 10:53:56, Petr Mladek wrote: > On Fri 2018-06-01 13:40:50, Sergey Senozhatsky wrote: > > On (05/31/18 14:21), Petr Mladek wrote: > > > > > > > > Upstream printk has no printing kthread. And we also run > > > > printk()->console_unlock() with disabled preemption. > > > > > > Yes, the comment was wrong > > > > Yes, that was the only thing I meant. > > I really didn't have any time to look at the patch yesterday, just > > commented on the most obvious thing. > > Fair enough. > > > > but the problem is real. > > > > Yep, could be. But not exactly the way it is described in the commit > > messages and the patch does not fully address the problem. > > > > The patch assumes that all those events happen sequentially. While > > in reality they can happen in parallel on different CPUs. > > > > Example: > > > > CPU0 CPU1 > > > > set console verbose > > > > dump_backtrace() > > { > > // for (;;) print frames > > printk("%pS\n", frame0); > > printk("%pS\n", frame1); > > printk("%pS\n", frame2); > > printk("%pS\n", frame3); > > ... console_loglevel = CONSOLE_LOGLEVEL_SILENT; > > printk("%pS\n", frame12); > > printk("%pS\n", frame13); > > } > > > > Part of backtrace or the entire backtrace will be missed, because > > we read the global console_loglevel. The problem is still there. > > [...] > > > So I'd say that most likely the following scenarios can suffer: > > > > - NMI comes in, sets loglevel to X, printk-s some data, restores the > > loglevel back to Y > > - IRQ comes in [like sysrq, etc] comes in and does the same thing > > - software exception comes in and does the same thing [e.g. bust_spinlocks() > > at arch/s390/mm/fault.c] I forgot to say that it was a great point and analyze. > My view is: > > The race with another printk() (console_lock owner) is much more > likely than a race between two CPUs manipulating console_loglevel. > > The proposed patch seems to be in the right direction. It is supposed > to fix the most likely scenario. We could block it and request full > solution but I wonder if it is worth it. > > I am personally fine with this partial solution for now. We could > always make it better if people meet the other scenarios. I am still fine with the partial solution. Well, I will think more about it before approving any patch. Best Regards, Petr