From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D25FC11F68 for ; Wed, 30 Jun 2021 08:57:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF09F61584 for ; Wed, 30 Jun 2021 08:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233591AbhF3JAR (ORCPT ); Wed, 30 Jun 2021 05:00:17 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:36422 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbhF3JAQ (ORCPT ); Wed, 30 Jun 2021 05:00:16 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9C6CF2258E; Wed, 30 Jun 2021 08:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1625043466; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k3LWsPEMkW74ELhpcy2lCJwxaP1hRY80ZI874/hdG3s=; b=b6dzuYNSBuTBl8Fvo8LI6O114tlulXQNfK/zd0cjKpOQXI05NtPi/w30/4i/G299bFMMge nh4nI/axYpkBWRkJ7FRt8rz1nAzG5xBCX0LBSn1NWusnnOo2cul+tPC2kNs2mToBgE0KIh MTvycDtAZ5WJrQknFni7xWGqjwT0gZM= Received: from suse.cz (unknown [10.100.224.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4B2E9A3B8A; Wed, 30 Jun 2021 08:57:46 +0000 (UTC) Date: Wed, 30 Jun 2021 10:57:46 +0200 From: Petr Mladek To: John Ogness Cc: kernel test robot , kbuild-all@lists.01.org, Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] printk/console: Check consistent sequence number when handling race in console_unlock() Message-ID: References: <20210629143341.19284-1-pmladek@suse.com> <202106300338.57cbEezZ-lkp@intel.com> <87zgv8bdei.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87zgv8bdei.fsf@jogness.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2021-06-29 22:59:57, John Ogness wrote: > On 2021-06-30, kernel test robot wrote: > >>> kernel/printk/printk.c:2548:6: warning: variable 'next_seq' set but not used [-Wunused-but-set-variable] > > I suppose the correct fix for this warning would be to change the NOP > macros. Currently they are: > > #define prb_read_valid(rb, seq, r) false > #define prb_first_valid_seq(rb) 0 > > They should probably be something like (untested): > > #define prb_read_valid(rb, seq, r) \ > ({ \ > (void)(rb); \ > (void)(seq); \ > (void)(r); \ > false; \ > }) This did not work: kernel/printk/printk.c: In function ‘console_unlock’: kernel/printk/printk.c:2600:23: error: ‘prb’ undeclared (first use in this function) if (!prb_read_valid(prb, console_seq, &r)) ^ kernel/printk/printk.c:2230:16: note: in definition of macro ‘prb_read_valid’ (void)(rb); \ ^~ kernel/printk/printk.c:2600:23: note: each undeclared identifier is reported only once for each function it appears in if (!prb_read_valid(prb, console_seq, &r)) ^ kernel/printk/printk.c:2230:16: note: in definition of macro ‘prb_read_valid’ (void)(rb); \ ^~ Instead, it might be solved by declaring next_seq as: u64 __maybe_unused next_seq; Any better idea is welcome. Well, it is not worth any big complexity. Best Regards, Petr From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8088752858996156630==" MIME-Version: 1.0 From: Petr Mladek To: kbuild-all@lists.01.org Subject: Re: [PATCH] printk/console: Check consistent sequence number when handling race in console_unlock() Date: Wed, 30 Jun 2021 10:57:46 +0200 Message-ID: In-Reply-To: <87zgv8bdei.fsf@jogness.linutronix.de> List-Id: --===============8088752858996156630== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue 2021-06-29 22:59:57, John Ogness wrote: > On 2021-06-30, kernel test robot wrote: > >>> kernel/printk/printk.c:2548:6: warning: variable 'next_seq' set but n= ot used [-Wunused-but-set-variable] > = > I suppose the correct fix for this warning would be to change the NOP > macros. Currently they are: > = > #define prb_read_valid(rb, seq, r) false > #define prb_first_valid_seq(rb) 0 > = > They should probably be something like (untested): > = > #define prb_read_valid(rb, seq, r) \ > ({ \ > (void)(rb); \ > (void)(seq); \ > (void)(r); \ > false; \ > }) This did not work: kernel/printk/printk.c: In function =E2=80=98console_unlock=E2=80=99: kernel/printk/printk.c:2600:23: error: =E2=80=98prb=E2=80=99 undeclared (fi= rst use in this function) if (!prb_read_valid(prb, console_seq, &r)) ^ kernel/printk/printk.c:2230:16: note: in definition of macro =E2=80=98prb_r= ead_valid=E2=80=99 (void)(rb); \ ^~ kernel/printk/printk.c:2600:23: note: each undeclared identifier is reporte= d only once for each function it appears in if (!prb_read_valid(prb, console_seq, &r)) ^ kernel/printk/printk.c:2230:16: note: in definition of macro =E2=80=98prb_r= ead_valid=E2=80=99 (void)(rb); \ ^~ Instead, it might be solved by declaring next_seq as: u64 __maybe_unused next_seq; Any better idea is welcome. Well, it is not worth any big complexity. Best Regards, Petr --===============8088752858996156630==--