Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp759616pxb; Wed, 16 Feb 2022 03:56:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJynCAlpZlpDWr0hV5PfZ/QxsnkdsSnclRXgqGJ8IM+7FdJZ/rHrOAue4xjMfab+4GgYznIC X-Received: by 2002:a17:902:b7cc:b0:14a:f110:84e3 with SMTP id v12-20020a170902b7cc00b0014af11084e3mr2232833plz.110.1645012602889; Wed, 16 Feb 2022 03:56:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645012602; cv=none; d=google.com; s=arc-20160816; b=Ot7Bh+FCojrjVP2/Bgk6O+GCeXLkri3KcraNT/iJaezqJGRgkXeB3BZs0SeLNPjgqS ylH1sH+BaJD6H9neiS+Ssx9vmTJ25mQEr9x5XSW9rjs/HAG+tclnpoSS1FIG9YZp7/Jj DM//kCzlqFi1DwCV1jOVcUa3SE378Eq3r/IZCLynW4XTdk8RAZGRbtxSqB8B4Yzl4M5H T8ngK6kim14joSg1xsQvzbEuJoFJgVWbqqRwUnGjBymT+wphEMPeyx1Ng8TxM7c4Nek1 FwxlBUwe+1Gp68WgBRnBbsMLnbIu2oIWPqnwkphGh0ybrM+K+lxpOPFB+TabaDI1Y+Nh g3DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=7HFLI/TL7yQT2vgFXIzmkiK2saqiC0Fu1IEgNvRbZTI=; b=mSzcZ60YMfUjDpDb158QTJ/hX4YtCsg33iFfH4SBb/pNonM8SEPiSooa7BzoixBXNZ SMvtNNt/CfLm/9Vgy7JESc6dhDI4wlHjjeRYuBZm6IzswLty4J3VmElHYfs1X2Sxum5k pAXPCwUD5oPCR4u1f8HocpX8pXpBJH0og1jHd084WLhpvDUUXBb/HZ/761ehGGC+cXLT GmeTuo5nCJiG/DB0QvgnrgpT9boFOzMFRHit9opRRdSrJm0Y502qoO0NoZmj7dOjct+2 OHNd8ch30V3YbHqcazjCr7BsdAKdGx9kYBr88SbdUIt1HMstne3rjmOTNURPzKjU2Wqs 1Rhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2si36772997pfi.316.2022.02.16.03.56.28; Wed, 16 Feb 2022 03:56:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232295AbiBPLrL (ORCPT + 99 others); Wed, 16 Feb 2022 06:47:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbiBPLrK (ORCPT ); Wed, 16 Feb 2022 06:47:10 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B65E446171; Wed, 16 Feb 2022 03:46:58 -0800 (PST) Received: from fraeml711-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4JzGQ00WYyz67gXC; Wed, 16 Feb 2022 19:46:32 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml711-chm.china.huawei.com (10.206.15.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Feb 2022 12:46:56 +0100 Received: from [10.47.81.42] (10.47.81.42) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Feb 2022 11:46:55 +0000 Message-ID: <8c582e45-0954-a2ea-764a-4dd78a464988@huawei.com> Date: Wed, 16 Feb 2022 11:46:54 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: Test 73 Sig_trap fails on arm64 (was Re: [PATCH] perf test: Test 73 Sig_trap fails on s390) To: Will Deacon CC: Leo Yan , Marco Elver , "Thomas Richter" , , , , , , , , "Mark Rutland" , "linux-arm-kernel@lists.infradead.org" , References: <20211216151454.752066-1-tmricht@linux.ibm.com> <90efb5a9-612a-919e-cf2f-c528692d61e2@huawei.com> <20220118091827.GA98966@leoy-ThinkPad-X240s> <20220118124343.GC98966@leoy-ThinkPad-X240s> <06412caf-42e4-5c4b-c9b3-9691075405bd@huawei.com> <20220215143459.GB7592@willie-the-truck> From: John Garry In-Reply-To: <20220215143459.GB7592@willie-the-truck> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.81.42] X-ClientProxiedBy: lhreml754-chm.china.huawei.com (10.201.108.204) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, > Sorry, I haven't had time to look at this (or the thousands of other mails > in my inbox) lately. > Thanks > I don't recall all of the details, but basically hw_breakpoint really > doesn't work well on arm/arm64 -- the sticking points are around handling > the stepping and whether to step into or over exceptions. Sadly, our ptrace > interface (which is what is used by GDB) is built on top of hw_breakpoint, > so we can't just rip it out and any significant changes are pretty risky. > > What I would like to happen is that we rework our debug exception handling > as outlined by [1] so that kernel debug is better defined and the ptrace > interface can interact directly with the debug architecture instead of being > funnelled through hw_breakpoint. Once we have that, I think we could try to > improve hw_breakpoint much more comfortably (or at least defeature it > considerably without having to worry about breaking GDB). I started this a > couple of years ago, but I haven't found time to get back to it for ages. > > Anyway, to this specific test... > > When we hit a break/watchpoint the faulting PC points at the instruction > which faulted and the exception is reported before the instruction has had > any other side-effects (e.g. if a watchpoint triggers on a store, then > memory will not have been updated when the watchpoint handler runs), so if > we were to return as usual after reporting the exception to perf then we > would just hit the same break/watchpoint again and we'd get stuck. GDB > handles stepping over the faulting instruction, but for perf (and assumedly > these tests), the kernel is expected to handle the step. This handling > amounts to disabling the break/watchpoint which we think we hit and then > attempting a hardware single-step. During the step we could run into more > break/watchpoints on the same instruction, so we'll keep disabling things > until we eventually manage to complete the step, which is signalled by a > specific type of debug exception. At this point, we re-enable the > break/watchpoints and we're good. > > Signals make this messy, as the step logic will step_into_ the signal > handler -- we have to do this, otherwise we would miss break/watchpoints > triggered by the signal handler if we had disabled them for the step. > However, it means that when we return back from the signal handler we will > run back into the break/watchpoint which we initially stepped over. When > perf uses SIGTRAP to notify userspace that we hit a break/watchpoint, > then we'll get stuck because we'll step into the handler every time. > > Hopefully that clears things up a bit. Ideally, the kernel wouldn't > pretend to handle this stepping at all for arm64 as it adds a bunch of > complexity, overhead to our context-switch and I don't think the current > behaviour is particularly useful. > Right, so what I am hearing altogether is that for now we should just skip this test. And since the kernel does not seem to advertise this capability we need to disable for specific architectures. Thanks, John > [1]https://lore.kernel.org/all/20200626095551.GA9312@willie-the-truck/ > .