From patchwork Sun Dec 29 17:18:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182543 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5449652ild; Sun, 29 Dec 2019 09:33:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzpPY5/nwhBMImLmErjn+Kogylcth2683YUjLEK3bMhJ+P6XWu4v/wWuRdRd4H6rzlaHey/ X-Received: by 2002:a9d:6a41:: with SMTP id h1mr36251012otn.279.1577640786561; Sun, 29 Dec 2019 09:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640786; cv=none; d=google.com; s=arc-20160816; b=0ikrs2AZLwaDVlGE19h8kqWIZAPjb9pxccyHeA9l/3bsV6zUHIqGEmNrQkHp/8aTXX ap+iQmxloB7abk1v2YxQuOHi35UkfOcfjAh4Uub5o1p7a3AjgUztXbEFzT3yMrnZV5K+ 3V0pc5Pp2dP//KUtFqkXIG5h1MCcgm6o3wJdldLFi5srB1OdQ1Ho0d/j6tzUyo26xhxl rP4sQKL1o85L3vpiAcdOCU+itN/JAkpjLaj6M91U1CTP+3quG2vxZaCSb+S/Py5blzgb XILmj33WVfNH62wsecKg/PTb7d4TFNq4kZrgoA1vaKvq1RBQJjsSiJtzzG29jUmtYMQY Gq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YbXRHwglRGZvBfVtbVGxZ94THApPXtkrz7ZHyH/mG3Y=; b=ko9EeGTJSvRikWP+QgSWU05591zFdxGRpsvX8SZa9JLuDwJDenv8ep1xvuBvLxAYvU KxaYNp9/1TRpAg0IgIQKDYa1gPZeEmWpFSoUsli4W/kBDkKR7bgP5Wf4eR5f35vs40/R 6iPFyE2aybi1j9d6xgU192jIuv5mNhW7peJtdC538SQpPoGfZ+0iaupgbeQzgM/hP/sY DJX2yv+l9GrNxuW6D5v4F1QgbMQ/XJxn8GJ4s/KAQszJ+aP155dq60mSHYvLz/RyAPdI +zIJTucqMjXSkOvoy+cLude3rXPMuwekcIsr5VeN5JW9mFR/4SEracK6rgMifLGqfh1O AZkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KNFEQ92h; 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 k7si19631477otb.90.2019.12.29.09.33.06; Sun, 29 Dec 2019 09:33:06 -0800 (PST) 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=@kernel.org header.s=default header.b=KNFEQ92h; 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 S1729389AbfL2RdF (ORCPT + 27 others); Sun, 29 Dec 2019 12:33:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:34124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727452AbfL2RdA (ORCPT ); Sun, 29 Dec 2019 12:33:00 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7EC720409; Sun, 29 Dec 2019 17:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640779; bh=1u3chDRibC6IUIfpSJQ4eqliyQuIjrD7HqX5Hcdi72M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KNFEQ92hjCedqTqm3uwnvEwrGCJfMfLfFHhohtvgLZxAZRqIvBEPmbqQsOeMKmfUD vOBbMDy/AzHcMseD6TLntRVUdB/8qZ3OVGw4saustjDOypzS+7IT3gKU9kmrIepOk2 POa0lqk7YsmjFiOqTL9CRN9y78oZODBGfqDclA58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Adrian Hunter , Alexander Shishkin , Brajeswar Ghosh , Florian Fainelli , Jiri Olsa , Mark Rutland , Michael Petlan , Namhyung Kim , Peter Zijlstra , Song Liu , Souptick Joarder , Will Deacon , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.19 086/219] perf tests: Disable bp_signal testing for arm64 Date: Sun, 29 Dec 2019 18:18:08 +0100 Message-Id: <20191229162518.590431950@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan [ Upstream commit 6a5f3d94cb69a185b921cb92c39888dc31009acb ] As there are 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 we 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. [1] https://lkml.org/lkml/2018/11/15/205 [2] https://lkml.org/lkml/2015/12/23/477 Signed-off-by: Leo Yan Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Brajeswar Ghosh Cc: Florian Fainelli Cc: Jiri Olsa Cc: Mark Rutland Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Song Liu Cc: Souptick Joarder Cc: Will Deacon Link: http://lore.kernel.org/lkml/20191018085531.6348-3-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/bp_signal.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c index 910e25e64188..6cf00650602e 100644 --- a/tools/perf/tests/bp_signal.c +++ b/tools/perf/tests/bp_signal.c @@ -48,14 +48,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) { @@ -301,10 +293,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;