Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp903009ybt; Wed, 1 Jul 2020 12:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/V3EXyDjDHr/MRnM6Q/s3mnvoi2L2DIp1Rjx9y/nVRmdZEg6KxzVKXBSqU7sVMrOqR6CT X-Received: by 2002:aa7:d0d1:: with SMTP id u17mr30304884edo.13.1593633571039; Wed, 01 Jul 2020 12:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593633571; cv=none; d=google.com; s=arc-20160816; b=kwf5haP5ooAnPEBm11WiA78DoMI6OF9JcEmUuPE1rJ6D+AnN+VpUYqCG5iSHTw5WwU 4pGZnEEoESZdqnW9wfa9l+X84C7IXuYm8H12N0a4FeE7cpw2Q/Y4y6ML6adGZUVxrWMU zmv34Oz2cThwnCSJ3KTVDB9qxExfKkhdDkja0wvgMrq++PkXP0ddyfubDgc1TWXgDH9t uuapFjvSkGFVPpl7WGzA/fa9Swu3YdzghM3RLZJRHar0iYDuw5UHASIbBX1hCDG4Yr7S gqkoMOxC0FmswOt0HCOhyuAQOlvtvoQhs8lbx1s7UI4G1bOhLQ8dlsxdC4h6CJI6s+em 33qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=lT9zajvxSVCwKbbkbNiXXnFEejqxJREj9fDOL+2G3jc=; b=iLRxBg87DNbQQZDeIqJS3TLu90i9ZqfoX7dqudkHW1J95hYRKKaBAtevGEHe94uIbV tMPAYDceZWkOUrmyBcrkh/64CeMvCPJxUngN1daMpzTpnKvLx8qu5INczBeTmW/s2PU/ iud/awbRNUj95ijShzfxdwzJVdGVlFKy633hIa/FVGCTUzGKx9BpQDYgrVYI7kB3XxWo 2Zr5Ww7NKSriNN59Ilkx//ZTBdNS9qVUlC4p5eWiucLPjHrY5pZ45/q1NZz40vTImOPM hJ3ScZ3gViPVrMq2mlpLxYf5JbZ6TnZFLnkKHHVF2AjEetWP4bCClpvZPB1v0Eo/gysi hmGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VcccQpHI; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=ElYBtgVa; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si4660486ejk.504.2020.07.01.12.59.06; Wed, 01 Jul 2020 12:59:31 -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=@linutronix.de header.s=2020 header.b=VcccQpHI; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=ElYBtgVa; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726863AbgGAT6W (ORCPT + 99 others); Wed, 1 Jul 2020 15:58:22 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:42176 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgGAT6W (ORCPT ); Wed, 1 Jul 2020 15:58:22 -0400 X-Greylist: delayed 165618 seconds by postgrey-1.27 at vger.kernel.org; Wed, 01 Jul 2020 15:58:21 EDT From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1593633499; h=from:from:reply-to:subject:subject: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=lT9zajvxSVCwKbbkbNiXXnFEejqxJREj9fDOL+2G3jc=; b=VcccQpHIsvg8wpMdxlOWoKrNzGvYmajmmFoLXjzZUKKQILCYVYE5LfRrogTRZ8dDCjlT01 BdjC+u2eH4lP+V1ra0QBZvUIeE50B9wQprM7isXv9dLDb47VJy9kNo9dQ/YUDGMkktOSSO tmhSuClHdemmm5KuiQI2gUDh6+Cuc8ryxcdxgkJgqd6eN2fzopIWXI1Qa4f8oDwLA9b4G2 SSGS9OVvxcMdrHp/AFW+pi+w1esuge7XuFWEwQBA6LYujcVDxPbTsE4W4M8UH50G6gvc6n 2y8BItFxCmEaaI+XIs2ya0nhNsZXRjO8JfDgxGZddjHdvn73MfEYoqawlW1FHA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1593633499; h=from:from:reply-to:subject:subject: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=lT9zajvxSVCwKbbkbNiXXnFEejqxJREj9fDOL+2G3jc=; b=ElYBtgVaS13sLgg5ngPELxflDHtPZGxBeD5FSbUKtihCrm6sIu6rK4MGDil2f7nPyfYoGt MFMRr3WPSDkAf7CA== To: Petr Mladek Cc: Peter Zijlstra , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , Paul McKenney , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: pending output optimization: was: [PATCH v3 3/3] printk: use the lockless ringbuffer In-Reply-To: <20200625151741.GH8444@alley> References: <20200618144919.9806-1-john.ogness@linutronix.de> <20200618144919.9806-4-john.ogness@linutronix.de> <20200625151741.GH8444@alley> Date: Wed, 01 Jul 2020 22:04:19 +0206 Message-ID: <87o8oznh2c.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-25, Petr Mladek wrote: >> --- a/kernel/printk/printk.c >> +++ b/kernel/printk/printk.c >> @@ -2009,9 +2056,9 @@ asmlinkage int vprintk_emit(int facility, int level, >> >> /* This stops the holder of console_sem just where we want him */ >> logbuf_lock_irqsave(flags); >> - curr_log_seq = log_next_seq; >> + pending_output = !prb_read_valid(prb, console_seq, NULL); >> printed_len = vprintk_store(facility, level, dict, dictlen, fmt, args); >> - pending_output = (curr_log_seq != log_next_seq); >> + pending_output &= prb_read_valid(prb, console_seq, NULL); > > This will stop working after we remove the locks. Consoles will be > able to handle messages while the new one is being added. There will > be no gurantee that someone is still hadling the previously pending > output. > > Please, always handle consoles when printed_len is not zero!!! > > The pending output was just an optimization added recently. Nobody > requested it. It was just an idea that made sense. OK. I will insert a patch before this one that reverts commit 3ac37a93fa92 ("printk: lock/unlock console only for new logbuf entries"). Then there is no @pending_output for me to implement and it will be clear that this series is changing/reverting some printk behavior. John Ogness