From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 9D849312802 for ; Tue, 2 Dec 2025 11:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764676417; cv=none; b=kh9rPRJbtdQFrYhcUdli1t6XaUP4zQAa3sboEfHMb4oeMEEG8wqSO2U3HDenjGsRgTFMC6zNbt+aAoMfahUZSRCjc9vEOOEM0AryGxAqZ6CZB0S9m9SpRpLVyH+SyHsjyx+V5DRGg+qKazJ0Y5LpPIdQEjtscc9tbD4QsGqBAhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764676417; c=relaxed/simple; bh=KersN2Y51szKaNs6c2hAWq7FbhaDJbeLs4PotwdSdZA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DrXwyxtLI4FYa3VvAA2RhCvQk6SgmcCQKfIFzXjNR8lsUnpkp33iVXAQyfqVPxYGGIBXaCw7hyLSRVlNED2nXCm7uPWQkho4YKMFpcWr4Jsb41xHAAwM8ZZb60MZ/5dP2Hn/jH12Q5qP4qh+B8MkzAGs2rDOkqTTbHJeItBQtIw= 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=nEfrQSWO; arc=none smtp.client-ip=209.85.128.52 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="nEfrQSWO" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4775ae5684fso25264395e9.1 for ; Tue, 02 Dec 2025 03:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764676414; x=1765281214; 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=ky2w92Omxf/9BARxmiNxHekw/fnnKDmtTcKK+1HQF10=; b=nEfrQSWO2LhLevI0EBJ7XAKbmoWOcOawPH2dzorQU72njzmxar5A9vf3P1ILAmpQKL 9a6RzOhS2jSXf4Ozi8p6qnocvePeT/jN1DxoaPzPoZFv4u7wrW0jKlB/TsFfy+awNwbU mazyhbB4K3nwPS1HkwCvBmWIRWzKRowrWTAoaPMYhRsJ5fV/tN2iV7KK9Xmz/M6CG24J A+mZrgOelkAsTYcRMlR7h3PlzR1j6WqXMmhXfDSerREVv4kp11n+qftGpM1s1Upl+ti0 JXED/aepSg80fZ9Ymrel4F2Xe3P2uVk3z6tO32TxrV8FIS02wjfKOLEhn09S/0MhmuJ5 VdCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764676414; x=1765281214; 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=ky2w92Omxf/9BARxmiNxHekw/fnnKDmtTcKK+1HQF10=; b=Bc2eH5STIoxBmklZ7iZMqzLhCoG96OmMvnDAMMBwQVVJ6Hxm9k6JU9MbAmddCA1g0J 5djAJ3NmPV60jk5THcKjTSRKnBMVxb8+hIS4zDWPulY8APps6Fd/YCN8oQNzopfpN+r5 RzSmY5Rtr+sgAsbhus8ogg6LfvTzIRnR8T+C39v3LZnPMJt5shXn6URxaiSecIHQyYtD n2nwIwiM8oXoYWDsYXQzxL4U1nIbx3OsMAWIXpoO+LM3CbTJ31n+Gl9PtpYeT7nMrV+9 SlnQHuZuqqwyQs1bLK0tSEbC/+2nPH5bEIlzWkPfwP+2rj88Q0HHLv9XIxZYpKxasXX0 8dXg== X-Forwarded-Encrypted: i=1; AJvYcCXk1yTMWTCh+PpvhrVwcA6F7llKQMz0zH8V0QxVkRUtf5Hu1QNkfWJInqJsb21Y60Rz8LGmEiqyz1r2qv4=@vger.kernel.org X-Gm-Message-State: AOJu0YzbQGEjyj6A/8MzIxF1Lq4y9merW4sNNGu8c+iacqlVb64WwRlt 1J8dm1KxAqMOMK+0fF51n6fjjKGr4VLEQKOnxO6bo9Ja8o9h7we/K91qBOsrXhOLbPs= X-Gm-Gg: ASbGncuh6LbKytEjuLER8+8Sg++VvCFW62p2P9GpRlLymswz1xi25Adq00AZjRjrMvL Jar0FpnXumNHLN7OdvFEdMC+hTMLmh1U1CassioTBDg45U6NMDKHW7HNuocqzHVAYLS1iS+Ed4Q lABetITAMb/+T3kHcdNUe3BePp/p7j8R5N/FaQLxfca7fpAQzM7pTJenCTBnObppKGywySzQcks sY1DLj9aWaxUckU7zmU1QZ/mii8PooFljkmyedHBEM5AchwWlLxvV5DNCt9V5sn70/nFhWn02+G 3t9787qLwtH3PIpicA+MN/lchLOZT0ZNAMi8Hd17V+D/69yH/orAanM49f5895pmYvTJ9XZosnK VfKubKTSsGBAlnSaYMvLjtWmVd3uyHfSb86C6AbYrmJZcuGfeYtldwRzQhD1tMSxTxUzyzpNWS5 DAWTkbaWlD4dRtms2bl3P8EWScj94= X-Google-Smtp-Source: AGHT+IFqrU0V5kVs+TCC64I17yPQZPoR+/rmB0ZAiKwFTKFWsdVaHH9xBGMrsABLHFk1fUDVIMmffg== X-Received: by 2002:a05:600c:4f46:b0:477:63a4:88fe with SMTP id 5b1f17b1804b1-477c1103099mr430150565e9.2.1764676413790; Tue, 02 Dec 2025 03:53:33 -0800 (PST) Received: from [192.168.1.3] ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790ade13ddsm353207785e9.8.2025.12.02.03.53.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Dec 2025 03:53:33 -0800 (PST) Message-ID: <53b24702-eb3b-4e08-bca3-70402eaf4db5@linaro.org> Date: Tue, 2 Dec 2025 11:53:32 +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 4/7] perf cs-etm: Don't use hard coded config bits when setting up ETMCR To: Leo Yan Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Leo Yan , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org References: <20251201-james-perf-config-bits-v1-0-22ecbbf8007c@linaro.org> <20251201-james-perf-config-bits-v1-4-22ecbbf8007c@linaro.org> <20251202114300.GV724103@e132581.arm.com> Content-Language: en-US From: James Clark In-Reply-To: <20251202114300.GV724103@e132581.arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/12/2025 11:43 am, Leo Yan wrote: > On Mon, Dec 01, 2025 at 04:41:07PM +0000, Coresight ML wrote: > > [...] > >> @@ -746,7 +779,7 @@ static void cs_etm_get_metadata(struct perf_cpu cpu, u32 *offset, >> case CS_ETMV3: >> magic = __perf_cs_etmv3_magic; >> /* Get configuration register */ >> - info->priv[*offset + CS_ETM_ETMCR] = cs_etm_get_config(itr); >> + info->priv[*offset + CS_ETM_ETMCR] = cs_etm_guess_etmcr(itr); > > I still think cs_etm_get_config() is better than cs_etm_guess_etmcr(). > > For ETMv3, we directly pass CONFIG to the kernel, and after validation > in the dirver, then the value will be set to ETMCR. If we already know > the config value is consistent between user space and kernel, why > introduce a redundant "guess" operation here? > > Thanks, > Leo Because userspace doesn't always come up with the same value as the driver. For example right now in ETM3, ETMCR_RETURN_STACK isn't set depending on certain conditions that userspace doesn't know about. ETM4 has the same for TRCCONFIGR_RS and maybe some others. In the future, other versions of the driver could do different things as long as we don't break decoding. I didn't want the function name to imply it was doing something it wasn't as that confused me a little bit. It's definitely not "getting" the value. Maybe "guess" isn't the best it could be, but it's not far off.