Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1181075lqp; Sun, 14 Apr 2024 19:20:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqXiSRfl846o2bbJox9GPmP7Zs2t4+1/6+gshctory6FQjc/Fp7FZmLIs14awdhRDuLRVE5c2ukE1TBVWRcy9lM6vA/5HLWBY7aKDgmg== X-Google-Smtp-Source: AGHT+IGoqEfIq3/6eooGtSieZNDa1S+eQ02z3oSX3v22Zyf9YlVC4BEXD912hjWb34LoZZBDRkoo X-Received: by 2002:a17:907:318a:b0:a4e:1ba4:f73d with SMTP id xe10-20020a170907318a00b00a4e1ba4f73dmr5970356ejb.22.1713147611897; Sun, 14 Apr 2024 19:20:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713147611; cv=pass; d=google.com; s=arc-20160816; b=KuuzYpWBcpnHSf0+by7yF7mM7SrEmXC1BVHcTTMPvGrtaqV2YiQZM3y5zaJnngNzAG sE31I/m+GENgWipML0LcldV4PyuNCaujAyAlZeCPpRxU1o79O2yqqQ8+ERGWBi+SY+EQ xCC0RnBYBfV9XwEXqae0omnfvkNZ7fXSb0W4sx2CX7zQagh9iH2STNLe/EbvopxL7zec Mdf964+sWEn2ecBW9L/IC/wSlnX4kYeTYU+TCi0TtZxj3UrxcXpc0ZwAAiHgfAieLBKp hWpuABxzBGutiEYRoShHrK89MiVcEU5BGnPd606Q8/bl7zcLl0RioAlXNQcY5RlZppDu iSGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=8o4K5dRyl8sIUjU0EgivmjJC3lGXyfUukYQCR3Ov8pA=; fh=vTsnBgfmiZntq90mI8hBDkY7VtpO0ddpLORpjU52MSU=; b=ImC22j5s032vgpBZdXR80B8gL58w0FEE+Q3xgS+X8uhvpo/wBJQDmRUskMBKKWyasm UWOlwIeWbPljNiHy3zyN8chQrUY4+0AqNR0TUdNT7nhl18JLHiCYVFQx07Bqx92T8JOb 4UKOLXvJ5qMYHECxh/NS9NalukpXSIkK+Py43FhIv2DC4kmEfO0GEASd88YLzdnwD9Ug L325vsyRDicHUGOgjShzfjS2RE3iVAAQ63m26iSLWEl4ulu06ijIZ6ApMqUymdzQGfUg kQe5onb2EHGjDUso3G1V65tRlX17oPSXQGnyQMNVYkCVVS85TMuJ3b0qgpPXgfdIj9Sv 8ZbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Wfh3cBf0; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-144482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144482-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q19-20020a170906145300b00a52277b9464si3684349ejc.857.2024.04.14.19.20.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 19:20:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Wfh3cBf0; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-144482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144482-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9F6561F2159E for ; Mon, 15 Apr 2024 02:20:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83D17134C4; Mon, 15 Apr 2024 02:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="Wfh3cBf0" Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1A881171C; Mon, 15 Apr 2024 02:19:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713147603; cv=none; b=aVDQN3/hwD7pfBZq74lZHm/FsunK+tHIkQyIypd8E4P2Fr5K97U5deHSDl0WjJRuUdawBjjs8Q732qFL2byBhL813Pm/Yn9MXTKf29kj58cU9brzr/caDKAykmMR86f5WVxHE3OVxcYeZq/svT/ewINb3JL+jfuAG4oKFbTIYBs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713147603; c=relaxed/simple; bh=3oU2p1In4W0koqh6Uc5YWekxPtYLC4K4W2NNnFMhURg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Zija+UX4+NovIuO79+qsNwT9xPRsaBdQ6eKC7wDaU4YK8H/MeMaO4yorlv2ubpmzhM0/CLg4OSoGHaev5OU2qX2xy1gQ7H0fHFkH67ajNnju0FoG8MFPOObzw6YH1D2ChbrumWU4IHt2lv/Jyqa7wCySEStQJZA8NtV4BfcONGA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=Wfh3cBf0; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1713147597; bh=8o4K5dRyl8sIUjU0EgivmjJC3lGXyfUukYQCR3Ov8pA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Wfh3cBf0QS/1UiJCGd9wNTsg4Z3JgU/S53A7sXuE66QjWbiVD9T5UErj+qdU+566N hjbiVLnV+ds0WJ+Ev+xRCLWWsYkNs/ydYleOUGiOgEvXor3j+0XD5ZTGMx7r9XyYx5 jn2svY0f1Sry8eWSJqE0BMCHAzNMPGqqW0t7XdRo/lDxhdZw7wJ9e8/OC/PSiEPyk7 59A2AycixIle915lKXR/ZEVvbbDPyQIwTiMKuZDpZGbvMmBz2pFKC82F8PzOQcpTbi j7+dgyBZn3vKLSDfhQN2vQw0ZU/QKf2x+gGzusuyAGdNvKz8OxQs5aM4xz/lfB0l96 UWGlHWQT/t0iQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4VHrV23GDlz4wcr; Mon, 15 Apr 2024 12:19:53 +1000 (AEST) From: Michael Ellerman To: Arnd Bergmann , Adrian Hunter , Christophe Leroy Cc: Peter Zijlstra , Dave Hansen , John Stultz , "H. Peter Anvin" , Alexander Gordeev , Vincenzo Frascino , "linux-s390@vger.kernel.org" , Naresh Kamboju , "x86@kernel.org" , "Aneesh Kumar K.V" , Ingo Molnar , "Naveen N. Rao" , Christian Borntraeger , Vasily Gorbik , Heiko Carstens , Nicholas Piggin , Borislav Petkov , Andy Lutomirski , Bjorn Helgaas , Thomas Gleixner , Anna-Maria Gleixner , Stephen Boyd , Randy Dunlap , "linux-kernel@vger.kernel.org" , Sven Schnelle , "linuxppc-dev@lists.ozlabs.org" Subject: Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG In-Reply-To: References: <20240410153212.127477-1-adrian.hunter@intel.com> <87be83da-6102-483d-b1dc-a77eecc9f780@app.fastmail.com> <4d429a10-eb45-4262-8e74-69af810ef1ac@intel.com> Date: Mon, 15 Apr 2024 12:19:50 +1000 Message-ID: <875xwjcqpl.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Arnd Bergmann" writes: > On Thu, Apr 11, 2024, at 11:27, Adrian Hunter wrote: >> On 11/04/24 11:22, Christophe Leroy wrote: >>> Le 11/04/2024 =C3=A0 10:12, Christophe Leroy a =C3=A9crit=C2=A0: >>>> >>>> Looking at the report, I think the correct fix should be to use=20 >>>> BUILD_BUG() instead of BUG() >>>=20 >>> I confirm the error goes away with the following change to next-2024041= 1=20 >>> on powerpc tinyconfig with gcc 13.2 >>>=20 >>> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c >>> index 4e18db1819f8..3d5ac0cdd721 100644 >>> --- a/kernel/time/timekeeping.c >>> +++ b/kernel/time/timekeeping.c >>> @@ -282,7 +282,7 @@ static inline void timekeeping_check_update(struct= =20 >>> timekeeper *tk, u64 offset) >>> } >>> static inline u64 timekeeping_debug_get_ns(const struct tk_read_base = *tkr) >>> { >>> - BUG(); >>> + BUILD_BUG(); >>> } >>> #endif >>>=20 >> >> That is fragile because it depends on defined(__OPTIMIZE__), >> so it should still be: > > If there is a function that is defined but that must never be > called, I think we are doing something wrong. It's a pretty inevitable result of using IS_ENABLED(), which the docs encourage people to use. In this case it could easily be turned into a build error by just making it an extern rather than a static inline. But I think Christophe's solution is actually better, because it's more explicit, ie. this function should not be called and if it is that's a build time error. cheers