Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1073409rbb; Sun, 25 Feb 2024 18:49:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0qRbW/iRLhnF1FLafNgIg+rLuX8pyUQO1l1HzpBnKDVxyWJBXa6S/vwJ/k//uSHjiza94kbBcTQQKpS9zOcYY5CQqhI0zftUkLVRE7g== X-Google-Smtp-Source: AGHT+IE1pp3BwRKJX6+Kq+YgG2ws8pWnpEV3FWHoLkuIdImAeNXAHyqfVVZT2cddRVoEGL26XLmZ X-Received: by 2002:a2e:2c14:0:b0:2d2:2e6b:dd5 with SMTP id s20-20020a2e2c14000000b002d22e6b0dd5mr3089432ljs.39.1708915794357; Sun, 25 Feb 2024 18:49:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708915794; cv=pass; d=google.com; s=arc-20160816; b=cvQrNvTr/M36gbCbmiYMroESjbQY+vUuDToSZTZhpiEaa/N9gcY/OuiYa0vKJ6UvFO bcdFP1rlRV7Id2WxDF6d5mJMBkTylZo8LOlUhzrxNi755+jgtyB2zTj9z0/U4rU9euTg l97sXlQaL3hfudixN5/6XvumslNR/7Zl71XEVkZ3pzwZN5r47jmLMSIzs7Nfct+wdvux 5PB0dMnZBaNeWnuZdhDBjjdNfIc38f8jUwxTaUqahTHv0C+9jQPpl36/ybSUqkYSCU8W BpPfja5VbP414iPFq4x32yYbQPYIbceo7szlMJvvcrrUygVoTIYF0gLRIEz/qAYPUC16 Srcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=jbNYk0VagaPM2Qy5nDoB6oWfOkG5T54nacKcSSor4Ew=; fh=rge/VD77jOQyuHrh0uLZ4cyD3eaGFvGAf8q8wqyWAIQ=; b=h2pNmGuykLi/2VsIwU3ARh/11tQ73jd3z+aCQNZy36vJJ4VT2PYMCwWZ6CDGSMuZBg S9VcNqE2AAg19apm0UXHBY5DypPPcJsMWeTYfsAdLJS9oq8mzlX1jiXuNSGQuiknWkBe yiEJtK567b7FlDNIVSeqh16+I0zCYDHs/PbIgq7jio+LwPI3zKX0iim7eE/WIxsLmiVx +IMdxTbTlP5oOkQDcrAJ/OhMYgdmW4HX0EOypNKOZIXg/vhqm9NPoW9PTuSetmC/sXQM bo1ZSYLtmtfyevr7yYOmwGvW5vqlDfZtsfzlqw3aaQ7J9sf1ofoqBFhZPVVcFIfwCI0n lEhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-80423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80423-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cq4-20020a056402220400b00562167084e0si1607875edb.260.2024.02.25.18.49.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 18:49:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-80423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80423-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1E4761F21F6D for ; Mon, 26 Feb 2024 02:49:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 744681401B; Mon, 26 Feb 2024 02:49:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9457212E55 for ; Mon, 26 Feb 2024 02:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708915788; cv=none; b=Y+Z7jzfb8mB46s4W4+KWoI89uInZnCJXMeL0+JrH5GxBOVSjZhmvnjK8CT2v737q9lo/wi+cgpWFG1EEKwj7AFehSJacE7gzdUXAFdynUJkHkKMjJT0GQeAK0g4G1VvdfPfXgQKUTe+lD5U+iE8tcAbidxMnYhAJS4Cna68aGzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708915788; c=relaxed/simple; bh=gTKXxYMLTzZTps02t2q9eElIfc+g8SPI/ED2qi5DiLA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PnFpYkdGXCV+CGRNdmz5rTCigUXyAAujrhgML80+PGToGxoo4qjD7Pn/w77/+uLV25uiUagwlfaxRVfppLXyD7COipY2GRrLQHWQCOcqh33rv+V4y0RiaxGTeSWNUwtoujRy+6ZfoYh5vL/6ai+ycvP/J8HlaIYfL7xqVkpvVDk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 638D61042; Sun, 25 Feb 2024 18:50:23 -0800 (PST) Received: from [10.162.40.19] (a077893.blr.arm.com [10.162.40.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 945723F6C4; Sun, 25 Feb 2024 18:49:42 -0800 (PST) Message-ID: <1901fadb-1d71-4374-be8c-00935bb27854@arm.com> Date: Mon, 26 Feb 2024 08:19:39 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] arm64/hw_breakpoint: Determine lengths from generic perf breakpoint macros Content-Language: en-US To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, broonie@kernel.org, Mark Rutland , Catalin Marinas , linux-kernel@vger.kernel.org References: <20240223113102.4027779-1-anshuman.khandual@arm.com> <20240223125224.GC10641@willie-the-truck> From: Anshuman Khandual In-Reply-To: <20240223125224.GC10641@willie-the-truck> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2/23/24 18:22, Will Deacon wrote: > On Fri, Feb 23, 2024 at 05:01:02PM +0530, Anshuman Khandual wrote: >> Both platform i.e ARM_BREAKPOINT_LEN_X and generic i.e HW_BREAKPOINT_LEN_X >> macros are used interchangeably to convert event->attr.bp_len and platform >> breakpoint control arch_hw_breakpoint_ctrl->len. Let's be consistent while >> deriving one from the other. This does not cause any functional changes. >> >> Cc: Will Deacon >> Cc: Mark Rutland >> Cc: Catalin Marinas >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> This applies on v6.8-rc5 >> >> arch/arm64/kernel/hw_breakpoint.c | 16 ++++++++-------- >> 1 file changed, 8 insertions(+), 8 deletions(-) >> >> diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c >> index 35225632d70a..1ab9fc865ddd 100644 >> --- a/arch/arm64/kernel/hw_breakpoint.c >> +++ b/arch/arm64/kernel/hw_breakpoint.c >> @@ -301,28 +301,28 @@ static int get_hbp_len(u8 hbp_len) >> >> switch (hbp_len) { >> case ARM_BREAKPOINT_LEN_1: >> - len_in_bytes = 1; >> + len_in_bytes = HW_BREAKPOINT_LEN_1; > > I don't think we should do this. The HW_BREAKPOINT_LEN_* definitions are > part of the user ABI and, although they correspond to the length in bytes, > that's not necessarily something we should rely on. Why should not we rely on the user ABI macros if these byte lengths were initially derived from them. But also there are similar conversions in arch_bp_generic_fields(). These hard coded raw byte length numbers seems cryptic, where as in reality these are just inter converted from generic HW breakpoints lengths.