From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 BF4D9346ADB for ; Tue, 16 Dec 2025 15:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765899266; cv=none; b=d6113BmaG7R8xjY5hZsAd0+6vxgVJvM+uoe29LhpQCXx9cRTEEIN4uycEVUSZo059yHIPhHdfxdEzy0egVxZheXtdNMoKTzMeSGCMNWj2ims8+D9epNu3jFSo4adWv3T8jr32pmUr4PtkNEFt3WA/phH2fECc/IVn6omk80jKqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765899266; c=relaxed/simple; bh=BwD7c/B+9PLPk2v9xcagtcKC2j04s6kUgQC0Cea6qJk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VGGDi5vZ6pK4B4jii1w88yDb9mbbqCL1iaBQAHyXpkMeGjksVbBm4p8Rp+BF98x318iUQ4tmEfu0MhmneytlVWjJ3Tl4tSt9muIxO6SangCB4O4sXTJNhh3abTtuWS6t6i2Nscx8S0mArW5uO0/3uTKZgoNUb0Jflxn9LODjJ08= 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=KBA6ARh/; arc=none smtp.client-ip=209.85.218.48 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="KBA6ARh/" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b73161849e1so1084084866b.2 for ; Tue, 16 Dec 2025 07:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765899263; x=1766504063; 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=/Z7tlw5t9I5onekdJgpQ0zadrbAsfQMzR4ajquHU3Zg=; b=KBA6ARh/i9n8mYzJJmv0td1hRhgG0aZajTIx+uljn65wAcASnS+16HJccui5ajuCK5 jfr44JiU69LHBUGovVqiCT9jl1xUxWkD735PBOFcIQzkcGFUbm7eLDy+CpEnI3cPiAI2 eGg5R4UVFuAoRnEF9l+6l1UyeAsqVki7O9uFr3wlWwav82oMjsq8yOuw5vyE4730EMAo 1NLwMipZY7ND+HhnucRn81YzxPdMnzQAuHaScMLpg0sbQ2CwQyFP6lnokPOQCCaeXCqz JMFPhQh8saTcSkCyKwUkWqK0rlvNsnXL8yzhUnD4IqauKB6Np5N83P28KzJV22NcNHaR ZkAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765899263; x=1766504063; 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=/Z7tlw5t9I5onekdJgpQ0zadrbAsfQMzR4ajquHU3Zg=; b=o7Za01pBshMAzYNqpx6tcIHLKNmBRcEcyPhGCpouR5MPdeFftZMN6YOS2mxJOQVIb5 PnwfzASHl+VU5H6JKTcLUkvFfUHi2swVxRba8viVsnAiffs7l0r4MXrnhPRPGzQQ6hlo p9xkgf3EKIyl2y556J1ltnCVkRuxeDHu5SwwvdbnJzt+L+wbG/rRcrv7NAziB15WDDdb uH4zGFc67lGId+UmlZcmYhs55eClp1sIl07WC5FjcsICVOdRqF34U7AWJ7NK+2zs9S3p c9LGQxEP4P4qiG2dI33VbxjkRq7k0DJfYAsGwjrV2pF/3hhC0QMj965NDaPd0Dqmk4jU Bd/w== X-Forwarded-Encrypted: i=1; AJvYcCU6wIpGUYoW+2mE9RNogmmwhr7h+WX63l4bOZN2S6KvJAGRLkVYJqXi9eR1Z5k4STDapjR8cn3Mv+7Mfrg=@vger.kernel.org X-Gm-Message-State: AOJu0YxQCdrod5ga5HSph2zKDCeMVqzWGBYWL+gx76sGk/yGVzUU3CUV RyaUhE+3XOAMLhCAx9DorHYam0XM6yB8YEKziWzY0tjPiqLaneE1MebFyX883mWoFGw= X-Gm-Gg: AY/fxX4mUfLgHWoxe70EVW0lir+gRClSXxzWbXB8QpYr5G9MYLVOdVkaPZJpnyiFU9j zYFVMUh3nV6QtWZ5eFk30tMpf1oLSiiK3QSybImBrlK57Y0HqHe06f1qQ0eHM/Qm9FA2KFilAra 2ME+cVrBy31GU30+zFD37HvlQdofVWhtDHC+MMA47jhbm3iuJs32XjtTlmnJisJFXxytsIQvooL aW5PD22Y6m33WPf0jb17ZqgvtcGWP6beCIJtj8TQfaV3sWTFjeezwMFQR0pzO2uTXW+d95HnSzH Mu+BrL/7aQKZoLmJWSnbEiNUD8hEmm5zj8uOu9EQKW6mu5sgR+sUgkHoZJZy6PoHMSKAbGTJEaN qSl9bJ0rH9KJOY0c4gQrOOs3zL/o5ckcPz0TD9Mv1JzqkldAyseBcMrqSNF/akROzyNKeC7LUry gibFuhxq5s0uIGj1YHqb5l X-Google-Smtp-Source: AGHT+IF22aaOZPWW0s+RyYbbqasWTKDbfGAAOMHx5UEmfu9aMhShyeRKOYdJclKZV7/QUKufUhVM0A== X-Received: by 2002:a17:907:608c:b0:b74:352d:6dc1 with SMTP id a640c23a62f3a-b7d236b61b4mr1659301766b.28.1765899263078; Tue, 16 Dec 2025 07:34:23 -0800 (PST) Received: from [192.168.0.108] ([130.185.218.160]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b7cfa2ea57csm1713270966b.22.2025.12.16.07.34.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Dec 2025 07:34:22 -0800 (PST) Message-ID: Date: Tue, 16 Dec 2025 17:34:20 +0200 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 10/19] coresight: trbe: Always check fault action when updating buffer To: Leo Yan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Suzuki K Poulose , Mike Leach , Anshuman Khandual , 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-10-7da32b076b28@arm.com> Content-Language: en-US From: James Clark In-Reply-To: <20251201-trbe_buffer_refactor_v1-1-v1-10-7da32b076b28@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 01/12/2025 13:22, Leo Yan wrote: > The current code checks the fault action only via the IRQ status bit, > which is unreliable due to possible hardware latency. This makes it sound like it's fixing a bug, but without a fixes: tag I'm assuming it's not a bug. Also I don't get how the change improves the latency situation, it still calls trbe_get_fault_act() basically in the same place. I think there might be another reason like it makes the code cleaner for a later change? Or the commit message needs some elaboration. > > Move the fault action check out of the IRQ status condition. This also > causes the buffer size to be calculated for non-WRAP and fault cases, > which is fine since the write pointer is trusted for the calculation. > > Signed-off-by: Leo Yan > --- > drivers/hwtracing/coresight/coresight-trbe.c | 17 +++-------------- > 1 file changed, 3 insertions(+), 14 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c > index f56ecdeaa6596afb440e4d53732e08a85f9bf89d..e579ea98523c24d23a0cd265dcdd0a46b52b52da 100644 > --- a/drivers/hwtracing/coresight/coresight-trbe.c > +++ b/drivers/hwtracing/coresight/coresight-trbe.c > @@ -806,7 +806,6 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev, > enum trbe_fault_action act; > unsigned long size, status; > unsigned long flags; > - bool wrap = false; > > WARN_ON(buf->cpudata != cpudata); > WARN_ON(cpudata->cpu != smp_processor_id()); > @@ -858,21 +857,11 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev, > */ > clr_trbe_irq(); > isb(); > - > - act = trbe_get_fault_act(handle, status); > - /* > - * If this was not due to a WRAP event, we have some > - * errors and as such buffer is empty. > - */ > - if (act != TRBE_FAULT_ACT_WRAP) { > - size = 0; > - goto done; > - } > - > - wrap = true; > } > > - size = trbe_get_trace_size(handle, buf, wrap); > + act = trbe_get_fault_act(handle, status); > + > + size = trbe_get_trace_size(handle, buf, act == TRBE_FAULT_ACT_WRAP); > > done: > local_irq_restore(flags); >