Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1443123lqj; Tue, 4 Jun 2024 01:24:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWB90BrZPdt1K2YlYe/bNbEXH/7xPqjVrg2AJfDHF6+RMUtPh3m9dVIECVeS/CLBU/mcYvfis+EGDtRTT0Tpo0tLCpNpklTH+3UOGewZQ== X-Google-Smtp-Source: AGHT+IFi7jjxnOMUanU0aJvekQV6UJCtTkxAX3kr7iPZJVFZolujQybz3miyuv2C14b/kTuLclQ2 X-Received: by 2002:a05:6a20:6a14:b0:1a9:d27c:3151 with SMTP id adf61e73a8af0-1b2a345c04bmr3390314637.23.1717489443604; Tue, 04 Jun 2024 01:24:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717489443; cv=pass; d=google.com; s=arc-20160816; b=rdZ1MMM2aA2x69X6ncJfYjldHAuH0ysbjazLAOVWQJMFVBxhlVpRxzwINmvkBST0hI i0O9jSAVuqJw3f3uiVHCVYGOvRL5IzZLDgp81VMNDz8srLTgxG8csEQ0tuNCaID5wzcn 3juPefavkZ7IGcrK4yskWsvocEVXUypXYZFHAL2y42IHODm1UxXhCQz9ajoo1wbaxwXN +/a3b9qe2BPU7i7yxLHvddm7Rz6Kfu3+cNovEBpENJjdWIq9lXx8CUvArSjsGoEQjZl7 S2u8HjCaFRq+AxJvGUqEPVXIXSanYZdn5FE0cW3tGI5LuevV68q3v/fT9Eo+8dijkgyl iBBQ== 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=L/IY8bPR7hBYGEY6uX/ZLYPEzz8knhcd+3cAy55nBNo=; fh=31vU/yofo5pzc6ZW35En4NC6PoGPqRtk5kIwkjT8hk4=; b=eReynmEM1dRs7Uy6t8Mz4s6yyN6ad/E+fA9TlVJwdIKG3jssFJEbATgdXxIeEKGngE 8NUB4RvCuPW8QKCcR7bTqq+mOwR46Re9vY9XxUP4nhYbPAEvNnCjShAX8RMurp3KQudm iwqEZPg95eFeuAlV8dKy6SJGwQ7bhagcBK86XmJbEOFLFde1wGmL5lkfp042ley+7+QC 596+8yiUmq2ytkImmzTrJTDAYkaFRqlxKI30IFi7dGcdXd/PUJ6gSY9ZoMyLdVEPUpYX HcvR+794JvtfTFTc86hKP6hOdqfVKiWagmLiDU9DQAQdH6RDvot/gAfg70wbmyIikeXj JN4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-200244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540faea9si738269a12.112.2024.06.04.01.24.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 01:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-200244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0162BB22167 for ; Tue, 4 Jun 2024 08:23:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B0BC1422D2; Tue, 4 Jun 2024 08:23:37 +0000 (UTC) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B04F82A1C5 for ; Tue, 4 Jun 2024 08:23:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717489417; cv=none; b=AagyO82CwNfMG1vRiyLJdGz2l6Wa4YfZSebaCdauHJqHGAHE7WXrKWy6aMJ1wmndU7NVej+X/yLZPrH/YzYSD6mFfzA6Jt9FvFkwJeLTZyYn1Pe8duZmMWXSKirGKAcK+A2dzhYHRsLDlVXaDSsg+8hYta0XbnbCn0r33qiN+aM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717489417; c=relaxed/simple; bh=RQvAbHhfGZydeK8yVv9kEPBowqkACBAOfaUsBflwvEk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=gSsYrmi9Yod8SGGGYJX/xL8zzFoLP6w3veO/gQsqib2quIPHqk1d3AnhFvLhN3S+UM2ns8KHUCdEI2T/1wvToNKQJItZ63T4WZ2Y257KgVoth0iQz7ZGxV8plqHi0rScK+AunGjBkLIVs9UrIcQQ5K/7n072TwJ3Xe85kfN6g9w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Vtk8s62gnz1xsGB; Tue, 4 Jun 2024 16:22:05 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id 826C4140155; Tue, 4 Jun 2024 16:23:25 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 4 Jun 2024 16:23:24 +0800 Message-ID: Date: Tue, 4 Jun 2024 16:23:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] ARM: Add HAVE_FUNCTION_ARG_ACCESS_API support Content-Language: en-US To: "Russell King (Oracle)" CC: , , , , , , , , References: <20240603073751.2282024-1-ruanjinjie@huawei.com> <3089651e-d8eb-f193-5eac-db925000dce9@huawei.com> From: Jinjie Ruan In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500008.china.huawei.com (7.221.188.139) On 2024/6/4 16:14, Russell King (Oracle) wrote: > On Tue, Jun 04, 2024 at 09:36:04AM +0800, Jinjie Ruan wrote: >> On 2024/6/3 16:39, Russell King (Oracle) wrote: >>> On Mon, Jun 03, 2024 at 03:37:51PM +0800, Jinjie Ruan wrote: >>>> Currently, kprobe on ARM32 can not use the '$argx' syntax available on >>>> other architecture. So implement regs_get_kernel_argument() and add >>>> HAVE_FUNCTION_ARG_ACCESS_API support. >>> >>> This may work in the simple case, but it just doesn't work in the >>> general case, where a function accepts 64-bit arguments. For example, >>> for EABI and a function taking a 64-bit argument followed by a 32-bit >>> argument: >>> >>> R0/R1 = 64-bit argument >>> R2 = 32-bit argument >>> >>> Now consider 32-bit argument followed by 64-bit argument: >>> >>> R0 = 32-bit argument >>> R1 = unused >>> R2/R3 = 64-bit argument >> >> I agree with you, the current implementation considers a very simple >> case, where all parameters are 32-bit. >> >> From "Procedure Call Standard for the ArmĀ® Architecture", the >> "6.1.1.1 Handling values larger than 32 bits" describes it this way: >> >> A double-word sized type is passed in two consecutive registers (e.g., >> r0 and r1, or r2 and r3). >> >>> >>> Note that the mapping isn't argN = RN. >>> >>> Also, given that "unsigned long" is 32-bit on 32-bit Arm, one can't >>> return a 64-bit argument through this interface. Even if one typed >>> the function as u64, it still wouldn't work because the caller >>> assigns the return value to an unsigned long. This seems to be an >>> issue throughout the kernel tracing - it isn't written to support >> >> How about updating this interface to solve this problem? Let >> regs_get_kernel_argument() return u64. > > That doesn't solve the first problem. The issue is that once we enable > this, it becomes userspace ABI, and any changes to it then become > regressions. Thank you! I understand what you mean. For the existing "$arg" API interface, ARM32 cannot determine whether an input parameter of the instrumentation function is a 32-bit or 64-bit parameter, and there is no way to control the user not to instrument the function with complex parameters, so this config cannot be enabled. > > So no, I'm not going to have it enabled in mainline in a half-broken > state. >