Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4062862ybi; Mon, 15 Jul 2019 03:16:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZmHa/F3jrtNC2JZUWsviX0bR/wGEz3RDpq4QRn0GmdlCX5hIKaw0A7oK2bIm7a9reC/bN X-Received: by 2002:a63:778a:: with SMTP id s132mr23627311pgc.242.1563185795361; Mon, 15 Jul 2019 03:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563185795; cv=none; d=google.com; s=arc-20160816; b=OahpWr8HJNP+Ad6+jlU39dinN8htltSC2wW4PuO+fnG9Kx8SVEsCgM7cjUfjR1fgP+ edfPF0JpbzFLmZDX4P2dAfSToEm7JjSSYlDGf3EEQmhxROmiwPNDjKobTL3v4hbu+4Uu efl/Vlf8nVhoNaZ5iu3NhfYISKCbo5rGSG7cMuZTqtu5sOo2OffiSTg0FWXh7QEdNQUJ 1GezOux2HMCxoQojZivcKs3aP4biuG6FgeG/5vqY5vN4tT406NDS3ROsbu6qywF8H2h+ 1qGezSSM5lk9DgT+UmugaLGWLcGU753no0eqA8MA6I8KPC5Vhb/qnDmzAoAgF2yj/D4p G8SA== 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:subject:cc:to :from:date:dkim-signature; bh=u79ZjFEuLDnH2Ysmk/AGaI9laDoHmEy4LqxmqfXV9VA=; b=W/+MNVA7SwVBK0/DCsZuTgiCAzU/OFDyKaZWB2AIRsl2/4FUfwbJ8Rsodv73zluAgb M2zc7np8xsgQJKzO7bTD47vyeWV9SoLF3LHktL+Id4+EzP037TWUrZDF5xn19ep0OVRq CxF83qQG8Ko2Ee4MHFa2cIRjf7SVyfxJOGBl+olccCM6aW9mRN4SHizyVwRqe/5ek1WG 8mrCeYxcM6ye5xKR9wapWFTCUtK8vNHe3AxFHx+wtQnTzQCguk1Gc1fuAr3KxeWTqgiR KG4AEqNqZlRt7DRSxU0ADnJJdoLetAdioMyzn6q29Oq34BSL8zSpWz0LM4miS4WeAE5A VSxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=N+v3iZfz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si15823983plv.130.2019.07.15.03.16.15; Mon, 15 Jul 2019 03:16:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=N+v3iZfz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729695AbfGOKPw (ORCPT + 99 others); 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--