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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 A6089C76192 for ; Mon, 15 Jul 2019 10:15:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7921A2080A for ; Mon, 15 Jul 2019 10:15:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.b="N+v3iZfz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729710AbfGOKPw (ORCPT ); Mon, 15 Jul 2019 06:15:52 -0400 Received: from ozlabs.org ([203.11.71.1]:42583 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729591AbfGOKPv (ORCPT ); Mon, 15 Jul 2019 06:15:51 -0400 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 ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 45nKDM6h0xz9sNy; Mon, 15 Jul 2019 20:15:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1563185749; bh=jsWNP/KQzccDDDLR5oNKr0dnsNeu8nGq7K7jrvJpn2c=; h=Date:From:To:Cc:Subject:From; b=N+v3iZfz3Z3sIjJn76r2EucYfJc3BUn9wQa/iH/stkhzk4HDQyqFapUvk7e3PNNu4 B7vKTbso21HAjPNstYXhjs2vvypSJPkCseTZJR5sYcUgK+D6vaTUyWWNtGJDlAp4wO nOZguZZcs6Wzj8byWYBViOgj4KVI8GEE3F8XHMyDXlsBRW4GOUUYQ0Q6q8nR08y9bj P4mZGTRKO/y2hWz8l1/zKNn9BpEukko61F3lPHZgfOqn51B97+aE+GFSqlOwtsUgdZ NdPADPAG7CyHsi385gOVX8NQQQopbhnrFmntxlmkVT6smPmEAeBJUejAteNEAYjnq2 ApaC694bG3IdA== Date: Mon, 15 Jul 2019 20:15:40 +1000 From: Stephen Rothwell To: Ralf Baechle , Paul Burton , James Hogan Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , "Gustavo A. R. Silva" , Kees Cook , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH] MIPS: perf events: handle switch statement falling through warnings Message-ID: <20190715201540.1e4bb96a@canb.auug.org.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/oJPxDdAJbbb=sRcigzwe5Q7"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/oJPxDdAJbbb=sRcigzwe5Q7 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Now that we build with -Wimplicit-fallthrough=3D3, some warnings are produced in the arch/mips perf events code that are promoted to errors: arch/mips/kernel/perf_event_mipsxx.c:792:3: error: this statement may fall= through [-Werror=3Dimplicit-fallthrough=3D] arch/mips/kernel/perf_event_mipsxx.c:795:3: error: this statement may fall= through [-Werror=3Dimplicit-fallthrough=3D] arch/mips/kernel/perf_event_mipsxx.c:798:3: error: this statement may fall= through [-Werror=3Dimplicit-fallthrough=3D] arch/mips/kernel/perf_event_mipsxx.c:1407:6: error: this statement may fal= l through [-Werror=3Dimplicit-fallthrough=3D] Assume the fall throughs are deliberate amd annotate/eliminate them. Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Gustavo A. R. Silva Cc: Kees Cook Signed-off-by: Stephen Rothwell --- arch/mips/kernel/perf_event_mipsxx.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) I haven't even build tested this, sorry, but will add it to linux-next tomorrow. It should be no worse than the current state :-) diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_e= vent_mipsxx.c index e0ebaa0a333e..40106731e97e 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c @@ -790,15 +790,19 @@ static void reset_counters(void *arg) case 4: mipsxx_pmu_write_control(3, 0); mipspmu.write_counter(3, 0); + /* fall through */ case 3: mipsxx_pmu_write_control(2, 0); mipspmu.write_counter(2, 0); + /* fall through */ case 2: mipsxx_pmu_write_control(1, 0); mipspmu.write_counter(1, 0); + /* fall through */ case 1: mipsxx_pmu_write_control(0, 0); mipspmu.write_counter(0, 0); + /* fall through */ } } =20 @@ -1379,7 +1383,7 @@ static int mipsxx_pmu_handle_shared_irq(void) struct cpu_hw_events *cpuc =3D this_cpu_ptr(&cpu_hw_events); struct perf_sample_data data; unsigned int counters =3D mipspmu.num_counters; - u64 counter; + unsigned int n; int handled =3D IRQ_NONE; struct pt_regs *regs; =20 @@ -1401,20 +1405,16 @@ static int mipsxx_pmu_handle_shared_irq(void) =20 perf_sample_data_init(&data, 0, 0); =20 - switch (counters) { -#define HANDLE_COUNTER(n) \ - case n + 1: \ - if (test_bit(n, cpuc->used_mask)) { \ - counter =3D mipspmu.read_counter(n); \ - if (counter & mipspmu.overflow) { \ - handle_associated_event(cpuc, n, &data, regs); \ - handled =3D IRQ_HANDLED; \ - } \ + for (n =3D (counters > 4) ? 3 : (counters - 1); n >=3D 0; n--) { + u64 counter; + + if (test_bit(n, cpuc->used_mask)) { + counter =3D mipspmu.read_counter(n); + if (counter & mipspmu.overflow) { + handle_associated_event(cpuc, n, &data, regs); + handled =3D IRQ_HANDLED; + } } - HANDLE_COUNTER(3) - HANDLE_COUNTER(2) - HANDLE_COUNTER(1) - HANDLE_COUNTER(0) } =20 #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS --=20 2.22.0 --=20 Cheers, Stephen Rothwell --Sig_/oJPxDdAJbbb=sRcigzwe5Q7 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAl0sUkwACgkQAVBC80lX 0GwDUwgAh2SIHjC/h//i4BX8AOnHj4bNibfhzoI/HVKv5V92vJZXU3hqUnjdF/5W ebzV+Ql37tu4vxdKRz1dMxKVnnG5jPZPy9RO0Ypk6yaDFD2fB2VE+J1JiBGUJx6l dFYtnVC4caMp76esSyVHTL1wnby1DBJEmCR63+SplYTRFsOP6Q9ZvBjvDSXoe7Qk LF2+4edvibne51hb8jMXWFKfaZiNmEyQtv7zAVN0izYpPW7CaqzOpfI7Qk8yjWtP DwkYvEukwjCUJuJ/TyqcbSXFzLdV99kEridDRs2s94vriT2JRwHdYSnrhD38PBNR xm/7mtII8pjQQuD9EI5X1pSQdRH+Zw== =V54a -----END PGP SIGNATURE----- --Sig_/oJPxDdAJbbb=sRcigzwe5Q7--