Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3938285ybg; Mon, 21 Oct 2019 00:55:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyV1uxIjiAiPnxkAwR+6Mg34yHhLu4N+W0KaT3OZ0zC/vPa95cXXjD2F44a+GXFX/Qmvm2 X-Received: by 2002:aa7:cfcd:: with SMTP id r13mr23965520edy.146.1571644504539; Mon, 21 Oct 2019 00:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571644504; cv=none; d=google.com; s=arc-20160816; b=Wq/LaNGiEwFHXGvYx+OVA55jIIi1MlB26Z6XmIpXdA5Jgshn9Cwx7mD4c5b1w4vbFC WxEgd0z/hCa1m9+1tgdi9tuer+1BZTMClOhGvhPo0kBxXmne/+OrCfZAns6wuJcH8TqO dg+Q3Zpiyfccb50L8s3vDcM6LDfGSdzNVBEDgGK8ItSyyah6uy3TGrDP9EaTips4YYIz mOG3/slrrwK3TUBugRgtCXfVKcs5bDu6W6QgCMOqh9htrvKTKlEa45xygGxTT0EqHhIr oMrptmjBJ3cvTctWnzy/H7KveaqmwxZsAWXi5M8Nc3hNpvcLL2+yQY0hcarMORuyaIBv JntA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/SqswiV+O4l/WvPEZbqOyv+SpkidW7GtfPPAGcnNlro=; b=KnBGcC2cT12OgVQV9ia9qENRXfZIUiMQck8iovfC+Q7i29ojRqmpjK2qC1DagqDy6F hXiHBoV2z8lp25w/z3N8uUvdsEijR3xAh1AtavuvCxg290XOle3NA/eCROrfYQwdyKt5 VaA5njO+P+N48tRfNHd3kw6FoEMeV+wvV8/d7NuGOaLZlR1hcSzGUt5d3aTdhhMM3FNe Sg6z+u7/YzyI0xgU7r83GYH4G9+tk5uRrqexOznGCskEleXN6cyrF68NQg6HlCQmzZIv 0RCZ/Am/7zoX9h+pHPdC/kUbNZ6GHkkJ/UJscpORAGSsKLJZttlfBGroUoaQmSBqYJhy yFmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pdoqibss; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d32si119566eda.380.2019.10.21.00.54.41; Mon, 21 Oct 2019 00:55:04 -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=@linaro.org header.s=google header.b=Pdoqibss; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727422AbfJUHyL (ORCPT + 99 others); Mon, 21 Oct 2019 03:54:11 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:39019 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727097AbfJUHyL (ORCPT ); Mon, 21 Oct 2019 03:54:11 -0400 Received: by mail-qt1-f196.google.com with SMTP id t8so2070385qtc.6 for ; Mon, 21 Oct 2019 00:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/SqswiV+O4l/WvPEZbqOyv+SpkidW7GtfPPAGcnNlro=; b=PdoqibssSlcMEEQ53CZ63eSRrYmPPLnkZDMZgGBmCq5XvIiOyzCrFVp2mH91akpnfZ gEImjUchoVdcoLkPHA5pGkYsyP3OOLmQUHsAA+FajIY1SdJBPd2Y6ilhoZ2IF6BSHN/k RQ2ZVCJthANygHVlre85PgooluSH3fXTKIiJn0dxBu/yVeBbBWb/i6FdcsEdlg0eaOo8 XiE7xmf80lZepuPdFZOQVScbputOjAOZc1nFz6Z6vV+m6wE4oCuUtti/9S0w6lfxcAS2 wDOAT2u37OGmy0LdRckKPAeGFfyKnfdWOFWssWed2ECiV3hWlnbJ0upJGvBDrqwk9G/a jMyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/SqswiV+O4l/WvPEZbqOyv+SpkidW7GtfPPAGcnNlro=; b=XtXRyj8D8t14P5Js/6uIQksuHoY0pYmPw9Grb0Vzx5kYqHW03BMcrij7tLo1s03oSJ wlp9F5ebR4djMNsblq5eCsWEZ6LSja3DGdwuqwAcJgGdqJUhQhwhgNf+b7eHb38e9U+N oj2HvLhTEzi5gFu+tol7SnT4Jp2VRcyC/EcBd8/7i075AaENo08OE2Xcn/OiofsPNtz/ 1k2Mv5YJtwf0FdQ3O5Gt1rCChqbS3KAS/DQSch3O0Zs5kLafhKnLvKIA+QnaCRdg8vsz ipw6Cq5800V35329Ez8li5UDwjVMA+GK37y2wG9hIosspqHDF3mxnsLoIUGu+Nyt4ArJ /vUQ== X-Gm-Message-State: APjAAAWEHXGH1fX+0OKRz1to5uI1/qK7Qw4MabgFTwqHQwxktDI8DT63 hLCGvxrmoc+25wexG58xGnXz/A== X-Received: by 2002:ac8:6890:: with SMTP id m16mr23414431qtq.227.1571644449713; Mon, 21 Oct 2019 00:54:09 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li937-157.members.linode.com. [45.56.119.157]) by smtp.gmail.com with ESMTPSA id 64sm7257589qkk.63.2019.10.21.00.54.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Oct 2019 00:54:08 -0700 (PDT) Date: Mon, 21 Oct 2019 15:53:59 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo Cc: Mark Rutland , Will Deacon , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Brajeswar Ghosh , Souptick Joarder , Florian Fainelli , Adrian Hunter , Michael Petlan , Song Liu , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 3/3] perf tests: Disable bp_signal testing for arm64 Message-ID: <20191021075359.GA26243@leoy-ThinkPad-X240s> References: <20191018085531.6348-1-leo.yan@linaro.org> <20191018085531.6348-3-leo.yan@linaro.org> <20191018175919.GC1797@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018175919.GC1797@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 02:59:19PM -0300, Arnaldo Carvalho de Melo wrote: > Em Fri, Oct 18, 2019 at 04:55:31PM +0800, Leo Yan escreveu: > > As there have several discussions for enabling Perf breakpoint signal > > testing on arm64 platform; arm64 needs to rely on single-step to execute > > the breakpointed instruction and then reinstall the breakpoint exception > > handler. But if hook the breakpoint with a signal, the signal handler > > will do the stepping rather than the breakpointed instruction, this > > causes infinite loops as below: > > > > Kernel space | Userspace > > -----------------------------------|-------------------------------- > > | __test_function() -> hit > > | breakpoint > > breakpoint_handler() | > > `-> user_enable_single_step() | > > do_signal() | > > | sig_handler() -> Step one > > | instruction and > > | trap to kernel > > single_step_handler() | > > `-> reinstall_suspended_bps() | > > | __test_function() -> hit > > | breakpoint again and > > | repeat up flow infinitely > > > > As Will Deacon mentioned [1]: "that we require the overflow handler to > > do the stepping on arm/arm64, which is relied upon by GDB/ptrace. The > > hw_breakpoint code is a complete disaster so my preference would be to > > rip out the perf part and just implement something directly in ptrace, > > but it's a pretty horrible job". Though Will commented this on arm > > architecture, but the comment also can apply on arm64 architecture. > > > > For complete information, I searched online and found a few years back, > > Wang Nan sent one patch 'arm64: Store breakpoint single step state into > > pstate' [2]; the patch tried to resolve this issue by avoiding single > > stepping in signal handler and defer to enable the signal stepping when > > return to __test_function(). The fixing was not merged due to the > > concern for missing to handle different usage cases. > > > > Based on the info, the most feasible way is to skip Perf breakpoint > > signal testing for arm64 and this could avoid the duplicate > > investigation efforts when people see the failure. This patch skips > > this case on arm64 platform, which is same with arm architecture. > > Ok, applying, Thanks a lot, Arnaldo. @Will, @Mark Rultland, very appreciate if you have time to review this patch and welcome any comments or suggestions! It's good you could confirm this patch so have more confidence for it. Thanks, Leo Yan > - Arnaldo > > > [1] https://lkml.org/lkml/2018/11/15/205 > > [2] https://lkml.org/lkml/2015/12/23/477 > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/tests/bp_signal.c | 15 ++++++--------- > > 1 file changed, 6 insertions(+), 9 deletions(-) > > > > diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c > > index c1c2c13de254..166f411568a5 100644 > > --- a/tools/perf/tests/bp_signal.c > > +++ b/tools/perf/tests/bp_signal.c > > @@ -49,14 +49,6 @@ asm ( > > "__test_function:\n" > > "incq (%rdi)\n" > > "ret\n"); > > -#elif defined (__aarch64__) > > -extern void __test_function(volatile long *ptr); > > -asm ( > > - ".globl __test_function\n" > > - "__test_function:\n" > > - "str x30, [x0]\n" > > - "ret\n"); > > - > > #else > > static void __test_function(volatile long *ptr) > > { > > @@ -302,10 +294,15 @@ bool test__bp_signal_is_supported(void) > > * stepping into the SIGIO handler and getting stuck on the > > * breakpointed instruction. > > * > > + * Since arm64 has the same issue with arm for the single-step > > + * handling, this case also gets suck on the breakpointed > > + * instruction. > > + * > > * Just disable the test for these architectures until these > > * issues are resolved. > > */ > > -#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) > > +#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || \ > > + defined(__aarch64__) > > return false; > > #else > > return true; > > -- > > 2.17.1 > > -- > > - Arnaldo