Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp379779pxj; Fri, 7 May 2021 10:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9XCy20tPde/hMmzfummy/seKoHAf3k/XItwJmCkP9AzX8xUteNjVRSjGfEwO+nGIKBlaQ X-Received: by 2002:a05:6a00:1a8b:b029:28e:7b62:5118 with SMTP id e11-20020a056a001a8bb029028e7b625118mr11224202pfv.49.1620408859527; Fri, 07 May 2021 10:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620408859; cv=none; d=google.com; s=arc-20160816; b=siCuxCl+LTRa4+IknZQKb5mJmrhs1AscQkfMIOqjq7ejVqoqkJOoElsqWWLXF2Pgw1 +SvLZlFXjrXLpmrARVvrfiFJhC59pczDqkeloqzSZ3fEj1xQfKUEhf9g6t/RlEv59tav 7bVja6lU+a+eEYAnB24V9fe3BjRbjOCxwqrXBfPNdWVJ7Lmi7rG6R4DXhaN3PYo42tYn KUTd463vKqepCRhwB57/jlhTY79GxZ+jTjZn5bhoXuJhjYphT0/JaGK1hdP5ewk2gU5C KIcayRM5p2JsKVEU37eErrOOhz/+atpSilWa+W9P7CV7h/VYZGMCwcFRy/wDaSAWothn UIIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6KzXqvMiRVjruPFLOERuSFj47yPPD+JdIfqMkIo8UmY=; b=tMWHcMlCT7iOFYJa6CT6cDTV7+c1Aw9lPWuouBiZOcn4mt3fZy99Kt9Q6IR7kYbsXT CvQuj0otIttWXDsjc+lkmabeFsUaEO8AATjzqrHPekZnr7x//lhsV6D7NlBOCnRnOf1J sgSqv42CBXFvSc1gAkYPKU2DxuUGp8sCXe4Gg/zEoEMqmfbRPoG74k+yHMK0/lSNlzSk LvGLkO5gotavp1Vky8dwOsL9yOrGUSqbTpfRXPeo+pNYHTyclF8pkuk+zZa+5xK1w7/8 QuuOge5n64GIT6mCSrSi25omh3RG+nDfPx6QuSgoor3YbZwjUcz7jCIKAsLAP03kkC5Q Si2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cx1f6VUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si2631652plk.422.2021.05.07.10.34.07; Fri, 07 May 2021 10:34:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cx1f6VUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235662AbhEGQOn (ORCPT + 99 others); Fri, 7 May 2021 12:14:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:54566 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234577AbhEGQOn (ORCPT ); Fri, 7 May 2021 12:14:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1620404021; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6KzXqvMiRVjruPFLOERuSFj47yPPD+JdIfqMkIo8UmY=; b=cx1f6VUJe6SWZOo3Eh0nPfjdUiW/HcyUubU2j00m0mt90tv1wQoN6i2CIbwjHfduwZoXQS C0wMGhwZLj5ickX69KmJ2o5bZijrpDfMGya9mMsutzvw7P2/fLNzF5mAMsUq5YGJSEi0lx ZzYarOFd8KzhNSuDqje74XmeXv1mHGA= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CF5F9AD80; Fri, 7 May 2021 16:13:41 +0000 (UTC) Date: Fri, 7 May 2021 18:13:41 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Luo Jiaxing , sergey.senozhatsky@gmail.com, rostedt@goodmis.org, john.ogness@linutronix.de, linux-kernel@vger.kernel.org, linuxarm@huawei.com, bobo.shaobowang@huawei.com Subject: Re: [PATCH] printk: stop spining waiter when console resume to flush prb Message-ID: References: <1620288026-5373-1-git-send-email-luojiaxing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-05-06 23:07:19, Sergey Senozhatsky wrote: > Thanks for Cc-ing Petr > > On (21/05/06 15:39), Petr Mladek wrote: > > > > Many printk messages might get accumulated when consoles were suspended. > > They are proceed when console_unlock() is called in resume_console(). > > > > The possibility to pass the console lock owner was added to reduce the risk > > of softlockup when too many messages were handled in an atomic context. > > > > Now, resume_console() is always in a preemptible context that is safe > > to handle all accumulated messages. The possibility to pass the console > > lock owner actually makes things worse. The new owner might be in an atomic > > context and might cause softlockup when processing all messages accumulated > > when the console was suspended. > > > > Create new console_unlock_preemptible() that will not allow to pass > > the console lock owner. As a result, all accumulated messages will > > be proceed in the safe preemptible process. > > If we have a lot of pending messages in the logbuf, then there is > something chatty - some context (task, irq) or maybe several contexts. > And those contexts can continue adding messages, while we print them > _exclusively_ from preemptible context only. without ever throttling down > printk() callers - something that console_owner spinning and handover > does for us. And those printk() callers can even preempt > console_unlock_preemptible() and cause delays and lost messages. Luo, please, correct me if I am wrong. This patch a about one well defined scenario. The messages are accumulated between suspend_console() and resume_console(). It is "small" part of the system hibernation. And we need to get them out now. There might be many if something special was debugged. I am pretty sure that Luo did not see any flood of messages: + Flood in more contexts would be balanced by switching the console_owner. + Flood in one context would be naturally throttled because this context will become the console_owner. In each case, these messages would be generated after console_resume(). Luo's original patch was explicitly talking about messages accumulated during the suspend. Luo, could you please provide some log showing the problem? Best Regards, Petr