From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 666E23590DB for ; Wed, 19 Nov 2025 15:15:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763565344; cv=none; b=ABfUuGVDNYSQtzoaZm6baEDGGpAjT0d8vVwShS1UNI7ltsj6zel+X+vX9Ftj5x+jSLq1Wtqq0vaY0k5Ei/R8Okp0KarzQ1VLSGxRYUAfr7Qii2jsqrp8cjX0tIxLbOU3op733IJT/D5nBL81x5s6T1NlIeBdf1Qg36613I7J7vo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763565344; c=relaxed/simple; bh=WVF378LbFwLBB2wVbn6cwzLPzlccU3KtYUUzAqIYrzg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GxdIRGUnXTEZB9glxEyYoz8naJnSGcFIB3TyW/w7hYGFgYaLEzg6+ECL51H9VQ5sKesUeSZ8PJTQ+ZiPKxAUreooTb0PkTyNk26c3qfn4Lk8CLnpp1vlLBUNKjEzGHoprVT0krG/gRrGmdzm/5IytNa6cNXkEgulTXIbw/agDSg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZJdwe86q; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZJdwe86q" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42b39d51dcfso3909413f8f.2 for ; Wed, 19 Nov 2025 07:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763565341; x=1764170141; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=40FUCiNe37Fnq+88hPBjHQqzpAUST38gJZwEDLQ1fMw=; b=ZJdwe86q+4Q/6YI37dQA4ZWLB+Cxk+F05Ct9ypBKlK+t/VYWSYZV5TYkwnA0lqBjdw YJOR8aDRymr41O4IExT2FYKZ6lx7DyfnKtBMA3eZPzs/6uRUaERvbATxqOZgCpvGxuRO 7TBjuoN8+fed3IHk6deVz8LhcD0mDoKXCjjmdkbPqYMyuzSX5M2ViwUfv0cEvXRw7PkF 7m0oSal1McamvJ30Bww8l+jy1kASqWtA4s0fDtDmXGFGYRmVTVhHgwSyricZxeTwyEmj uM6/cKQg1GvTeCo9cVPClRXyORNTpfOeLTj25mW64Va4KwOGuJqg/27ow9YXdHamHbo4 IUww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763565341; x=1764170141; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=40FUCiNe37Fnq+88hPBjHQqzpAUST38gJZwEDLQ1fMw=; b=kgDE9W1VHMCrf1hr0wZ/TOQYeOr/KdkCjwCbxDxYLz497vAUJCbuQzLMqgUnyrzCyT SHgJLe2s7RuK1NUnc4Q5xkVZFhYYw9QghLzz9Uhy3iY0dNrNG3Cmrleg0EEcY9/mSMNu AwMe63Izc3nGTjBws7sIP7IG5P+JN2xOyktp8x9PrGn28VdnLn8rjaucATXJRHrxIgnA lCASvzRhx4EwuP1rEHnLuDsmTOjDigMbOgN6zF+cW7GtuGZVLe7HI3+C2KD71ki4eLWb P3WFkuCj783hfbx4r1ltB/9GOHJZZ9MSoJfiKkIKFvQljPfJeakqs4MtwHVM6S6QQHJW yzdA== X-Forwarded-Encrypted: i=1; AJvYcCUDLQsoV4/hMzU44dBRE3CfhVJx+6by1FLwZ0GwNeYHs/myvuFO6Eej0mRy0zGkoalYEyBr2wKu/25McNQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/birvf5zMn8PckX/YE/hjl4s7KNpNbPcT5oiTPOV3N4hh9DiU swWsF8IpCj9i20pr677YetqCn2ILDWSaR9C7jr+DDn5pc3E2AajmdcDDzIT50Dq1kPc= X-Gm-Gg: ASbGncsrK7dhhwCyhTrdReOUVS5MdnYtMrg28wQ7MnmZMmVQzgJMeZErbgRGFqspeX6 xRzpwk+/OCfev7YNf9v3mCkuYQtiERtx3MJ7HIAfKWCyII6FnUDnooJGOJH41k5WgJN7uXkZpI2 PJfa2XvsBNW5I0/gVXChEqTSO4C7Imq9wJyIpIFme1nM8ushMCCRr8rgT6j8NYm5Scl+745UHjy 19a6PXi5nk6t70L6Xdoo2fVdtcIyEJEeHSveCaBOzhEmO5SFo3P6S+YFJ0XxkS5PCnc6jqKaFr4 Jwl2bxhXpEIXBz4fpYIzE0bJPlDMHeA9WMGvpzxwvptEVbrLwe83KkRC5mQUVC/uljJINBZKCHV HpJpdvnsMXIlOqlfAlQuMf5FACScfgyitHicUz9CPd6W+lknZLxRjvqlvsHnxoxPjpETqYSN5GR oeY15uNPk3NczDZWUETJa7qd6okvE= X-Google-Smtp-Source: AGHT+IEdJcHPoiyWTs3kHkkIy8jDxEKTn292cUpANiNFB7Utp4jeLkleNQmmD+5zgCoeUg929Agzig== X-Received: by 2002:a5d:5f49:0:b0:42b:36f4:cd21 with SMTP id ffacd0b85a97d-42b593742e7mr20124823f8f.40.1763565340777; Wed, 19 Nov 2025 07:15:40 -0800 (PST) Received: from [192.168.1.3] ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b62dsm38526469f8f.24.2025.11.19.07.15.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Nov 2025 07:15:40 -0800 (PST) Message-ID: Date: Wed, 19 Nov 2025 15:15:39 +0000 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 v5 08/13] coresight: Interpret perf config with ATTR_CFG_GET_FLD() To: Leo Yan , Mike Leach Cc: Suzuki K Poulose , Alexander Shishkin , Jonathan Corbet , Randy Dunlap , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <20251118-james-cs-syncfreq-v5-0-82efd7b1a751@linaro.org> <20251118-james-cs-syncfreq-v5-8-82efd7b1a751@linaro.org> <416cf32d-d647-46dd-bcef-acc019490561@linaro.org> <43a60afe-5170-4801-ae70-9243cf7b45b8@linaro.org> <20251119123647.GC8204@e132581.arm.com> <20251119143751.GD8204@e132581.arm.com> Content-Language: en-US From: James Clark In-Reply-To: <20251119143751.GD8204@e132581.arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 19/11/2025 2:37 pm, Leo Yan wrote: > On Wed, Nov 19, 2025 at 01:55:15PM +0000, James Clark wrote: > > [...] > >>> static ssize_t format_attr_contextid_show(struct device *dev, >>> struct device_attribute *attr, >>> char *page) >>> { >>> #if IS_ENABLED(CONFIG_ARM64) >>> if (is_kernel_in_hyp_mode()) >>> return contextid2_show(dev, attr, page); >>> #endif >>> >>> return contextid1_show(dev, attr, page); >> >> Not having an #else implies that the contextid1_show() part is valid when >> !CONFIG_ARM64, but that isn't right. That's why I had the WARN_ON because >> it's dead code. > > Based on ETMv3/v4 spec, would contextid1 always be valid ? (Though we do > not support context ID for ETMv3 yet). > It's not currently supported for ETMv3 in perf mode, which is the relevant thing here. So format_attr_contextid_show() never gets called for ETMv3 (equivalent to !CONFIG_ARM64). Based on the spec it may be supported, but that's a different discussion and I doubt anyone wants it so it's unlikely to be added. >> Personally I would drop the is_visible(). It makes sense for dynamically >> hidden things, but these are all compile time. IMO it's cleaner to just not >> include them to begin with, rather than include and then hide them. Then the >> extra condition in format_attr_contextid_show() isn't needed because the >> function doesn't exist: > > This is fine for me, though in general I think the dynamic approach is > readable and extendable than the compile-time approach. > > Thanks, > Leo I agree in a perfect world, but it seems to have caused confusion and wasn't that clean because is_kernel_in_hyp_mode() only exists for arm64. I'll send a new version without it.