From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 9F01B22A4E1 for ; Tue, 9 Dec 2025 14:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765292064; cv=none; b=dyQJhKSAU1LeH1XXIMJrfGmS9dAHXluG2vVZxOtkSfaOAsfjzit3eevIGGQuBxqff6SdzIudLAabEgnRGXAPp7QCO9bX+n2Ov2F9mMKKTi6jUBGV0Npemz7bwHn8nqN9sEgX13DI9pZjg0YFWOOtZGGXcyMaBAJ45Ta3A5rtr3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765292064; c=relaxed/simple; bh=eD96g5pjvDYVpYtQr11/TYM85QIVc625ilw8ytDPk+A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=L+SDhQ0y7ecYNVILJVmB/wGiOfIUyY16aJ3zUEBxBfpF22fiwSVzX3GgO/N9NtCPu76srg4kJmy14OqN7hG9b+lSJPKrZB2ICbLTKTx+H4QTOn85mdInqMPP8Lz6u0fy0lo2bfgmzzs5ztf4LbpxC54tR4l5HCmSe5EnF5YkSiY= 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=KS0AVTRP; arc=none smtp.client-ip=209.85.221.50 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="KS0AVTRP" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-42e2e167067so2549991f8f.2 for ; Tue, 09 Dec 2025 06:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765292061; x=1765896861; 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=I77rqlgPE4VEYTyOhE8C9IAUeqfQbxcz2xaE/KeMMmY=; b=KS0AVTRP/WlJvMYqa/K0bKr+ALn1lPkv4Hf3QYP6VQIfMc+LTtd0eQ/9IJ2uWzEeVx 960WInvVI5e/ckaIagJxw6jJfczMIuc7YcfnvYAnitkCh23f4VvPKIOuisJBuxJA0/3F JtSIQEO6hluxU4Au16azlUgPrzCgP7wTg6QLrNElzCIAmkdgWYqpg8Wjgz1fSPpID7cE gyApcBXMCch8WYjfTCAqbkonpAAe/QacZvw/msSvCjbFYixgALXApUz8ChDW1M0IkfYB sErvItk8xFNeGfLEEBy9sYGmbJ//yddbaNmvxggjfSdXKDcMgdDUocPuL0EXEDOu4y9k KHXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765292061; x=1765896861; 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=I77rqlgPE4VEYTyOhE8C9IAUeqfQbxcz2xaE/KeMMmY=; b=LVpkuplt/2kFED3GB2kpjlUy++D683u9zuBSulz6G+x/iNGSXbpfRU7JrVFpte8b8L ALDfimMoxglpai+ETEeLRfY3wD3gVfnNrZSHeezQun2kHUpeTycWdmt2WeailAlWK3R0 KxGIKps3kQsZeB1gnoaTdWZbtrAS+dTgilezIQLkQfqjf8iF/c0M+9aPgTJTa93bg7k8 GlvSyf491nFiPpSH/GAOQtMXf+jSt5VXUe6jmMJ34mNjpaGIN7pgbMb914/PI7wPMssl Fy8PgFA8HFkx8UPsLM1WfYhguyv04a+EDmEfIAprVO9ESUpHJ3JMo8JKxHuS0OHhJg+z VOcw== X-Forwarded-Encrypted: i=1; AJvYcCVyP5nft5MG8/k75W5EQH+E/3XX3fWOM11tgKRB7rGXY6XjXFBfog4MjamPwoiq9rMKfgzNLdjMF3Dviog=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2tQmFusyG/ztMvphczAl+7tJdNCVXNlTUIdQtfrm6U1oixMKM 4D8u2etQr1XfQnQ6oKPnGMPC/K3vZ0NlUJItPB7mCr6AZwpFb9rWIr/iQuoLdG41x7Q= X-Gm-Gg: AY/fxX4ucd1gNJ0A7/bQVhqvPqHnjwSQh/XTGD3YVnXAjzWhgmKgYMIoh8ayupzovWX V54JWPByAAW+V9cpBGE5p+1NQq2oASjBbTDUWhkYH5Bsp/jmieT6/t1qmqr13gvaKCoEkFyytrS y6384P3rhvo7JIZMtYPPkHju5+A+tYMU+dWU5vpPgF8OdfAjvUWbRsrSb7QFjrWTyJ934v9o39V cYsrK+rq5t1y68hKd2jfNw9CJW001LPcyQ7XkUOfHWBm29LPqP/HGhjUU47yHOT1t/JhB1aqPDr 7jjk08HhoPHEUFZoKA1XjHIY4hWvo7mFGnACGfExz6oY1nOTbuCzStbZTj8TRetY3ZyuPL9+l5I 4JkC3w037/9apaUGMjRYmIaY9uaV25I0FwAp5cwFvdBw4BjjHna68XDAlXmd5pubBPYJuMiff8Q Zp1YUWZkMPxIIWRGlY X-Google-Smtp-Source: AGHT+IG4v9UP6u54PQph65mR9oenZhjMF6WsEAAW8pYbnWdPqIyPTf06tVvcbxXr0zMULbQ5hddMqg== X-Received: by 2002:a05:6000:2284:b0:42b:2e1c:6341 with SMTP id ffacd0b85a97d-42f89f0ab32mr12255937f8f.9.1765292060866; Tue, 09 Dec 2025 06:54:20 -0800 (PST) Received: from [192.168.1.3] ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42f7cbff352sm32569419f8f.17.2025.12.09.06.54.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Dec 2025 06:54:20 -0800 (PST) Message-ID: <5ebf1743-b01c-4664-961c-9e1e2aa7ffce@linaro.org> Date: Tue, 9 Dec 2025 14:54:19 +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 19/19] perf: cs-etm: Set watermark for AUX trace To: Anshuman Khandual Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Suzuki K Poulose , Mike Leach , Yeoreum Yun , Will Deacon , Mark Rutland , Tamas Petz , Tamas Zsoldos , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter References: <20251201-trbe_buffer_refactor_v1-1-v1-0-7da32b076b28@arm.com> <20251201-trbe_buffer_refactor_v1-1-v1-19-7da32b076b28@arm.com> Content-Language: en-US From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 05/12/2025 4:48 am, Anshuman Khandual wrote: > On 01/12/25 4:52 PM, Leo Yan wrote: >> The default watermark is half of the total buffer size. In many cases, >> the tool can not be notified with sufficient free space, especially when >> profiling with small AUX buffer (e.g., 64KiB). > > Could not smaller AUX buffer be prevented for TRBE instead ? > It's not really about the size of the buffer but where the wakeup points are. With only two wakeup points (middle and end) once you pass the first one you are immediately into the last chance end section. Now the driver is writing into the end section, but Perf is still reading from the first one. Once the end one fills up, you end up with no space left without Perf having a chance to say it's finished reading. To guarantee free space, there needs to be at least one additional section as a buffer zone. Ideally we'd set the wakeup point at thirds so there were fewer wakeups and still have one free section, but it might not always divide by 3, so 4 is also fine. The commit message could probably explain it a bit better though. The reason this is different now is because we want to be able to enable wrap mode as much as possible. If you imagine the scenario where a half way watermark is hit, you can't enable wrap mode without wrapping into Perf's part of the buffer (the beginning) as it's all that's left after the second half. >>> Setting watermark to quarter of the buffer to notifies the tool to read >> data earlier and prevents the data loss. >> >> Signed-off-by: Leo Yan >> --- >> tools/perf/arch/arm/util/cs-etm.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c >> index ea891d12f8f40beebf8dee1d3db71cad701f5666..649b8b0d0f92b4af45fb97db9da3c5ccf24a978b 100644 >> --- a/tools/perf/arch/arm/util/cs-etm.c >> +++ b/tools/perf/arch/arm/util/cs-etm.c >> @@ -424,6 +424,13 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, >> pr_debug2("%s snapshot size: %zu\n", CORESIGHT_ETM_PMU_NAME, >> opts->auxtrace_snapshot_size); >> >> + if (!opts->auxtrace_snapshot_mode && !opts->auxtrace_sample_mode) { >> + size_t aw = opts->auxtrace_mmap_pages * (size_t)page_size / 4; >> + u32 aux_watermark = aw > UINT_MAX ? UINT_MAX : aw; >> + >> + cs_etm_evsel->core.attr.aux_watermark = aux_watermark; >> + } >> + >> /* >> * To obtain the auxtrace buffer file descriptor, the auxtrace >> * event must come first. >> >