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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 52E6EC7618B for ; Fri, 26 Jul 2019 12:38:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3150622C7E for ; Fri, 26 Jul 2019 12:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbfGZMi3 (ORCPT ); Fri, 26 Jul 2019 08:38:29 -0400 Received: from foss.arm.com ([217.140.110.172]:42694 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbfGZMi2 (ORCPT ); Fri, 26 Jul 2019 08:38:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6DBC5337; Fri, 26 Jul 2019 05:38:27 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E1C13F694; Fri, 26 Jul 2019 05:38:26 -0700 (PDT) Subject: Re: [PATCH 1/3] arm64: perf: Mark expected switch fall-through To: Will Deacon , Mark Rutland Cc: Anders Roxell , Kees Cook , "Gustavo A. R. Silva" , catalin.marinas@arm.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20190726112716.19104-1-anders.roxell@linaro.org> <20190726121056.GA26088@lakrids.cambridge.arm.com> <20190726121354.GB26088@lakrids.cambridge.arm.com> <20190726122728.jhn4e6wq7rcowyi4@willie-the-truck> From: Robin Murphy Message-ID: <1549fe77-367f-fee1-c09c-e429fca91051@arm.com> Date: Fri, 26 Jul 2019 13:38:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190726122728.jhn4e6wq7rcowyi4@willie-the-truck> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/07/2019 13:27, Will Deacon wrote: > On Fri, Jul 26, 2019 at 01:13:54PM +0100, Mark Rutland wrote: >> On Fri, Jul 26, 2019 at 01:10:57PM +0100, Mark Rutland wrote: >>> On Fri, Jul 26, 2019 at 01:27:16PM +0200, Anders Roxell wrote: >>>> When fall-through warnings was enabled by default, commit d93512ef0f0e >>>> ("Makefile: Globally enable fall-through warning"), the following >>>> warnings was starting to show up: >>>> >>>> ../arch/arm64/kernel/hw_breakpoint.c: In function ‘hw_breakpoint_arch_parse’: >>>> ../arch/arm64/kernel/hw_breakpoint.c:540:7: warning: this statement may fall >>>> through [-Wimplicit-fallthrough=] >>>> if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) >>>> ^ >>>> ../arch/arm64/kernel/hw_breakpoint.c:542:3: note: here >>>> case 2: >>>> ^~~~ >>>> ../arch/arm64/kernel/hw_breakpoint.c:544:7: warning: this statement may fall >>>> through [-Wimplicit-fallthrough=] >>>> if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2) >>>> ^ >>>> ../arch/arm64/kernel/hw_breakpoint.c:546:3: note: here >>>> default: >>>> ^~~~~~~ >>>> >>>> Rework so that the compiler doesn't warn about fall-through. Rework so >>>> the code looks like the arm code. Since the comment in the function >>>> indicates taht this is supposed to behave the same way as arm32 because >>> >>> Typo: s/taht/that/ >>> >>>> it handles 32-bit tasks also. >>>> >>>> Cc: stable@vger.kernel.org # v3.16+ >>>> Fixes: 6ee33c2712fc ("ARM: hw_breakpoint: correct and simplify alignment fixup code") >>>> Signed-off-by: Anders Roxell >>> >>> The patch itself looks fine, but I don't think this needs a CC to >>> stable, nor does it require that fixes tag, as there's no functional >>> problem. >> >> Hmm... I now see I spoke too soon, and this is making the 1-byte >> breakpoint work at a 3-byte offset. > > I still don't think it's quite right though, since it forbids a 2-byte > watchpoint on a byte-aligned address. Plus, AFAICS, a 1-byte watchpoint on a 2-byte-aligned address. Not that I know anything about this code, but it does start to look like it might want rewriting without the offending switch statement anyway. At a glance, it looks like the intended semantic might boil down to: if (hw->ctrl.len > offset) return -EINVAL; Robin. > I think the arm64 code matches what we had on 32-bit prior to > d968d2b801d8 ("ARM: 7497/1: hw_breakpoint: allow single-byte watchpoints > on all addresses"), so we should have one patch bringing us up to speed > with that change, and then another annotating the fallthroughs. > > Will > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >