From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 5DEF33370E3 for ; Thu, 4 Dec 2025 10:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764845744; cv=none; b=sT/x11lH0piM4DGISu+iAp1UhYIoULDoubTPAh9oU7SojlV6t6yiYh/HqQmRweH4/P90AQn1MOAWgP+HZcatwNJoW9q+ktKu+2P20TABLTOhsQJxuuJ6dx3FgmubC3o9UrelGH55TREjqM2LAOG6gm34z8WCwBWoFT1RL7eujWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764845744; c=relaxed/simple; bh=SgJNoLR6K3fNtJPZOlFwZxsl2xtwua+Et9HkEmnnc8E=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=hJjbhrD/GZh21vlf7I439dHrvqeKaXjLzI3BOz7J07Tg0adFEQ7NPiu3QvVe7Pcy5QXjsNZYCDnFlMPRpYTU2YL3PSk27Szv7TnGXaG1Hng7RebGYxNwD/PRrxD0uNSl8u0v1Y269I7eUik+G+2s4oXP57vkv57ylLWI2yDrblc= 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=M2JhWHiD; arc=none smtp.client-ip=209.85.128.46 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="M2JhWHiD" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-477a219dbcaso8052295e9.3 for ; Thu, 04 Dec 2025 02:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764845739; x=1765450539; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=7MK1DoZ8jdaWVf6WB3pp5Ox5xAT5z0hNR1E+xIMlTlc=; b=M2JhWHiDN90koGFzrh5dCJd4POstAJv7UXshzK0bLd0R9lqGOTyUCOUKGJWW+LCSCB EELX7nC19dA/HRBkWgBYxBwN9AsWqiL+/KXL/dHyaeT7a7psrvRvb/v9/YTD2rGU9NYL hdsD2tCzxW2dccYDU63g8+FiWZurSblHDMMhaswDCWoIrgXOzrkSch04A1HLtvQ758fQ 63RshHBv5ysHYD7KA7Df0tMnFLgauF2QKG8BXFCZ+qGHOQyryGoz/baQUHoADWbW/vD3 3NGSKwmgvewDyVdjLMA7dsZZuFFlCW1Q1m/5UKjsKiNj5m4GDWW4/+UIkzBmCv7Et60P xhzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764845739; x=1765450539; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from: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=7MK1DoZ8jdaWVf6WB3pp5Ox5xAT5z0hNR1E+xIMlTlc=; b=NLqNA4HI414ojv227WMgZxB17FLpAAglNqb1+NTbtnSZOg26c0sWazlf84vW+t6i69 PhyyUUQECpot7nXagLuEjNal2FmiWHjGxd7lkLwC2BkQST/gphj+M/J2SV8P6IKfQtCZ /Q7XgNyHyRGyY+E8vpmbPFrIApO6of4oNN66YV1ozYCK59ZN0RFUnLgqmtqI/u5puVe8 1jfaSUPjFOQDHCq2y3u+SVxuEGbydCPqM9ThaEvRIklTef5fLAjd9cKHbkQtYEkcjDpu yEW/afOphuIDC9mSUJ8eRbIxik4FKXoGDyE24ZFzuCVV37sqy/WFHWZeLnmqmjcgPXDS BNLA== X-Forwarded-Encrypted: i=1; AJvYcCVj3FztHm1G4EW/w9Re0yXd9Glo73uPWvuypgoGXhuIuf8xoNgQK5dy8x14sGzQE55aOAvw+0j9JUdwM04=@vger.kernel.org X-Gm-Message-State: AOJu0YzqgN4BnsG+cBqraq2RCTB+UqjDJt2nhYHFK+U8tGemkr6pxqXU klEQU5znFj7v2md2FgI3KWLCSTjAyd5j21WRKfPMITDs4EHM6RSWqy8ludwLTw5DtJs= X-Gm-Gg: ASbGncsa17AX0WkxAF7GDxjklGYyIbVbuk0v4GBdHH9IwSCH5SM/NUSZftSOSsAxrmX QSgKiS9nEGf7gZcr624QlrDk52u7P8//k41A3rCEsDID9XA6IvvsNTnGrde+Xa49mdSGQfRT3fO BnrDTMDdSZoH/1KAUWbu8AfDdB/uZOV+0aG4MKGJIl8RcxNqtN1OYgUdZKnr8jJNceDWAlivfZj zfBIvMyOBPHh60vECZskJtEKKAKyC6rSQ6g8VQ3in72sDZm1opregGutu5czxiYY0S4ErsstiTy h5VPW4a5Ccb5HSbM6FwuNwMjDeOO99d4h3zFVyUavGLZTXTyip0DUKg2h2FCVseFoxWYH3OisFc FuhjPvMF9UmjsfUn6S29eubBPp/uSq52in4DHGjORzg5E4pW97yIpKptskVWRaq4N2dbcaH+T+W VubPOnoTBTig2IsRM1AE7wijX0zqY= X-Google-Smtp-Source: AGHT+IF/hw6YXo0ND/050KonkHRNTrdsi5Huu1bqezplzyoJWuA2V3KAYQIym/bIYa2FHGR7FnQb1A== X-Received: by 2002:a05:6000:4029:b0:429:b8e2:1064 with SMTP id ffacd0b85a97d-42f731c3147mr5483314f8f.47.1764845739098; Thu, 04 Dec 2025 02:55:39 -0800 (PST) Received: from [192.168.1.3] ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42f7cbff320sm2520602f8f.18.2025.12.04.02.55.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Dec 2025 02:55:38 -0800 (PST) Message-ID: <96c54895-cebe-4247-86e6-d41b8be0dd40@linaro.org> Date: Thu, 4 Dec 2025 10:55:37 +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 From: James Clark 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> <53b24702-eb3b-4e08-bca3-70402eaf4db5@linaro.org> Content-Language: en-US In-Reply-To: <53b24702-eb3b-4e08-bca3-70402eaf4db5@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 02/12/2025 11:53 am, James Clark wrote: > > > 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 One other note is that since moving the timestamp field, this is no longer true either. The value in attr.config isn't directly put into ETMCR. >> 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. >