Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp889410pxb; Wed, 27 Oct 2021 14:32:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd8OVbaZ+y6FMj7UJlufaU1YU+Nabl3hw1MGKd8QoL8OMnSBV5+4hqyjRypO9ASifNx3vM X-Received: by 2002:a17:907:1dcf:: with SMTP id og15mr62817ejc.553.1635370333527; Wed, 27 Oct 2021 14:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370333; cv=none; d=google.com; s=arc-20160816; b=I1Jqja5TgrZ7N+zZU+rUhKMjISjy2m9/z4c0eGycxMwmrOM9LaRxgoxa2Gxxy8IMwT x2A/JJA9yYiwOCny3DNgyxkuv023PpHCZtaWQBhuF4aDYKVHDdM6ykFfXVR0ZWLInXo9 pwt4twf1sDBH2TEu9kKIm6G17ROzREtnLC2Q5SaUidQ2erzf+zhGoSJHimhkt2jBT3ph Do0fnN5gGlI9+GNILBvwvildoR1ACop8RBKMS7XUpd3UBH063sZO4lHtehX3yFW3p45x wUIFpkhLhEqg9icX5+SVnjfKFf3Dqksh+wrBLZNg2d2qLcxkDR/sXxAEiWO2+g7OGbfP ORiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=tkgVdeXd598pY6QU8+NQfjeQPsQIGyv6eN0Glc1LxB8=; b=tbNv/6/Ord5v0GsTRXPKpwG6m3V+kwHBtFHaxQUp2YzDKi9oR2/1G4VfAxbtX9p3z7 RtiYLllJS/Lfcpv6fClaBhrJ3Auntn8KKpvftd2wcQTjGMdeYSYx+WstEFx52CUgL57O oJvQkFeh2kjXgYIZo6fWxzm8a5ocrI3EuuMQxLB+gI872rFMvU4tTouK+WpZqVN8s+02 IC9J89+MT4YtyjLSZC4TIscVobofOH7FhDfjkqZRPhjteaEhdkdCJQNTKfiRDhsP4zaF z8j5j4yvxfL1nc8iok4sdXJhaeC0wXT5lNDZK5zOUdHcXRBfTz4YynZIe0h5Gddv+06y ygXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=E1mttTQN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="vFfC/cCf"; 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 qk38si1692805ejc.373.2021.10.27.14.31.50; Wed, 27 Oct 2021 14:32:13 -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=E1mttTQN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="vFfC/cCf"; 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 S242829AbhJ0PvK (ORCPT + 97 others); Wed, 27 Oct 2021 11:51:10 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41318 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242827AbhJ0PvJ (ORCPT ); Wed, 27 Oct 2021 11:51:09 -0400 From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1635349723; 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=tkgVdeXd598pY6QU8+NQfjeQPsQIGyv6eN0Glc1LxB8=; b=E1mttTQNJGFfAAYzAmlbyJlajz+M1aCHTFA0exSqMApNuSblDEJ/VWVzbUiib9QPsnIDSG bqG1p6eHKr32gHH7LUa8Q6gm7GWXtBCoano7f85qDMZU6wimszeQAUxkgoVmuWymqt5g9+ gkB/aJR5hqmxLjaG+ud4Pmh8pBFBoy8wObsI0NagaE90M1vtHKn/OSm+1id6atWiPHy3qE 2jAwkoPAuPLantUo940hSj8BskMyWLcoR12DuYwbcAvPhGg/FAXm8Yu1iq9MGl6r/Wvxch SgG9+XVztZfP6u1CV2he2FKpjLX92dXO5RKZBwYEhoKMj/xOElRmQqeo5QtsVQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1635349723; 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=tkgVdeXd598pY6QU8+NQfjeQPsQIGyv6eN0Glc1LxB8=; b=vFfC/cCfKpiBQYOBxRqi7Tsb/O51LcCf3i/k0yyiJi6iXtBd7cWNLp5srPz34r7Ueikskh GZvvGnQTSpWHdTCw== To: Petr Mladek Cc: "chunlei.wang" , Sergey Senozhatsky , Steven Rostedt , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] printk: ringbuffer: Improve prb_next_seq() performance In-Reply-To: References: Date: Wed, 27 Oct 2021 17:54:42 +0206 Message-ID: <875ytih3j9.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-10-27, Petr Mladek wrote: > diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c > index 8a7b7362c0dd..24f47fbefbb5 100644 > --- a/kernel/printk/printk_ringbuffer.c > +++ b/kernel/printk/printk_ringbuffer.c > @@ -474,8 +474,10 @@ static enum desc_state desc_read(struct prb_desc_ring *desc_ring, > * state has been re-checked. A memcpy() for all of @desc > * cannot be used because of the atomic_t @state_var field. > */ > - memcpy(&desc_out->text_blk_lpos, &desc->text_blk_lpos, > - sizeof(desc_out->text_blk_lpos)); /* LMM(desc_read:C) */ > + if (desc_out) { > + memcpy(&desc_out->text_blk_lpos, &desc->text_blk_lpos, > + sizeof(desc_out->text_blk_lpos)); /* LMM(desc_read:C) */ > + } > if (seq_out) > *seq_out = info->seq; /* also part of desc_read:C */ > if (caller_id_out) You also need this hunk: @@ -530,7 +530,8 @@ static enum desc_state desc_read(struct prb_desc_ring *desc_ring, state_val = atomic_long_read(state_var); /* LMM(desc_read:E) */ d_state = get_desc_state(id, state_val); out: - atomic_long_set(&desc_out->state_var, state_val); + if (desc_out) + atomic_long_set(&desc_out->state_var, state_val); return d_state; } Sorry, I missed it in my last review. This time I build+boot tested the patch. With this hunk added: Reviewed-by: John Ogness John