Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1625555pxy; Thu, 6 May 2021 11:44:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztju5E4xrxcn5qpIqVZ31eg21GkPue3k2UWTCL2OGK9pjRCdisCqEXcHFRfhcZgxo2U448 X-Received: by 2002:a63:2542:: with SMTP id l63mr6047005pgl.128.1620326686463; Thu, 06 May 2021 11:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620326686; cv=none; d=google.com; s=arc-20160816; b=uFUcxu35CZMp4LEMPlSLEm8vhVGAJRDOOcTup+ihsYkZnpLE90h5wX6XJb+xVjQw0b 3Cp0/bmUdeo0xTBLlEvPX9iZkSZDL2EHRdRUpMsEfYXJBiOs4h1R/cOVUNFymbAUGCtG +UgF+LwcZ5o+8Qc5Z7i6qvO0jGxDMoMDe570eRMBIFmwEBRIYXcfUfoTimlpH4iTxoxL nBrfJkPP6jBMC74O3ipDT/1EU0G4KNPSusfQ+MqtBRGgJ3R7dQFx5qfykfJT3njOjwlD xklOVsHgxv27TDXTkzMt9x9quWb1tAAbZP5uI1U5Wb1jdnMKbq2PgC9wFawwyq4GpscZ RHKg== 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=wqyyyHnK8FiNMaf9JVPI3razJE+a2ZRHcYe96jC3lb0=; b=U/+8fElj8zboW6qR8Wy+c22y2V8xkuCabuOS54Koi7dCdKdHB8GiH3sG08p6pdLR6l UCO3LCW1StNmcMKmcbNAOS5gT+Z0ERBRPo5RPv6hAj7Q+6Cr9LL2MhMhtpvXlZSwjBlW 0MvmDhdJVsUqr+cYg5jpmGiVrjCenNE07ErNwSXRInCtENDfZt16nP0nNNxQQgVmSqkb 25wTZBKbnotzbuvsUcb+R6tJp27pTWbAjYPBZG1VW9Zyf7CkPP0/pe8gvg4J3Xm2x+HL z4xK+PZ5CfJGbDDFRYMWXT39rAjAmUGujPMNgobSRJ1RY30Oq5K1AKUnfd+AMxEz8qPe 32tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MeSMvYen; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si5168070pgj.144.2021.05.06.11.44.34; Thu, 06 May 2021 11:44:46 -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=@chromium.org header.s=google header.b=MeSMvYen; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234557AbhEFONH (ORCPT + 99 others); Thu, 6 May 2021 10:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234402AbhEFONG (ORCPT ); Thu, 6 May 2021 10:13:06 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78BE5C061574 for ; Thu, 6 May 2021 07:12:08 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id t4so3458919plc.6 for ; Thu, 06 May 2021 07:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wqyyyHnK8FiNMaf9JVPI3razJE+a2ZRHcYe96jC3lb0=; b=MeSMvYenteOQAETWwt+P404i5W2zP9ivfegBQCpWp++yIwNvPEwJyPxU3DlepBQ28t 8lSvInNgZmRM1XlWLMDjbkAyv1pP0oollrKs7UsPf8WyXPPa2ZERIyaTlFBL4dC7xDzY FtBAr5kPatLJfpves0RlM4WcmXfvOAPTJvsTs= 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; bh=wqyyyHnK8FiNMaf9JVPI3razJE+a2ZRHcYe96jC3lb0=; b=kPArQU6obiLDs4S63RDE9AZsNsAIK2dSwSAYPB8NIDqVViHj1MGbJtD7Lx+BQThbJq TgUCf0r2/7TZEsUC4E7tFvrlY6fopE+soR/PJ6subXr6bVAsGtds857VII6fg013cR+m Pupunll/PZw4njY/xUeIqoOFbgKZzMH0S6cYHnjd3/B08NwUH8VN4AQhiJ+Kn90XQPPh izuF/Tki056pmswT7YFSN3AldRfYQ9R49FNpUvUDNX7hvoqd5Akw3CenF6P9twRHmtUS pO3/Ia6zZx4l+ysgVr5Z8URNo0CejMA0ES+M/OgFcbqv61c5kt1nMa/0Sj7RAxyaUlGk WMjw== X-Gm-Message-State: AOAM5317c4QCA3Ux6nLwMmgWL9QDjrycC9VGtUTxo5n+JYZFnWkVJnNB RTKYrFsPULwAyJKOchQX3f4tvg== X-Received: by 2002:a17:90a:9312:: with SMTP id p18mr17446752pjo.171.1620310328048; Thu, 06 May 2021 07:12:08 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:421f:8358:b929:bc6d]) by smtp.gmail.com with ESMTPSA id m15sm2027845pgu.4.2021.05.06.07.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 07:12:07 -0700 (PDT) Date: Thu, 6 May 2021 23:12:02 +0900 From: Sergey Senozhatsky To: Petr Mladek 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, Sergey Senozhatsky 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 (21/05/06 23:07), Sergey Senozhatsky wrote: > > Can we count the number of lines that we print from the `current` context > in console_unlock() and if after N messages there is no console_lock waiter > waiting for the `current` to handover console lock ownership, then create > one: schedule IRQ work that will become a console lock owner, spin on > console lock and call console_unlock() once it acquired the ownership. > That 'artificial' console lock owner will do the same - print N > messages, if nothing wants to become a console lock owner then it'll > queue another IRQ work. Or even simpler console_unlock() { ... if (printed_messages > limit && !console_lock_spinning_disable_and_check()) { printk_safe_exit_irqrestore(flags); console_locked = 0; up_console_sem(); defer_console_output(); return; } ... }