From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15D9D2E7635 for ; Thu, 12 Feb 2026 23:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770940346; cv=none; b=Rary7i30WkgiclTFwrvdqqfME4Kae+snXaVAk29p0xcZ9NBcnDBySWZmO1eRig3bzxi+cgVHNn2hEl3cBwJoI1qugjJylexKD4xQvRbvVBNqyOsduWNFXtIG24FL3KBcIUcPjoPKi9B6bh3oqc7Tw4Dy1tpBMp34Gm7D8sAaIds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770940346; c=relaxed/simple; bh=1Gv34DN+wpw2vQsxJlIaG2grupH6BycIl6ffM7xkWLA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UtPYaLch59h5rAGQtlH1hdtX2NesHTiU/1zn5HxAx9cUwmxfUnRTDXhUtbyfFCABSvVX2aXLkIOBr+/y3fbLohp2EmnzD/8rNINa+2R/tXPZli70TpZcLb0JD/QAYvojYK0sz4/AWWDdZP7vt5i7IPyj3yV1rp1sM2ztMOpB+wg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=F+8nzL6V; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="F+8nzL6V" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770940333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1xQI/Fr3XtpQFzHaYiW8tEPZj7GG6uqufZbmsGpsNuo=; b=F+8nzL6VuN/9C+H8xOTeUws+J2lN3fCcDtq/8xVHSnu/kueFQJ9rnkDiSzxP+YY/TlALnU pQAlBOf/PL9rAFc50w5Mj7MPm2IIGKC5ZmoUbOyJcDLxpuluuJhH7hatQfnjIRsQw27bC+ zVXz3Rei2l2NR5xlhDhN7A5wKAxVptM= Date: Thu, 12 Feb 2026 15:52:01 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2] selftests/bpf: Add powerpc support for get_preempt_count() in selftest Content-Language: en-GB To: Saket Kumar Bhaskar , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: hbathini@linux.ibm.com, sachinpb@linux.ibm.com, venkat88@linux.ibm.com, andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, song@kernel.org, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, christophe.leroy@csgroup.eu, maddy@linux.ibm.com, mpe@ellerman.id.au References: <20260212092558.370623-1-skb99@linux.ibm.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20260212092558.370623-1-skb99@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2/12/26 1:25 AM, Saket Kumar Bhaskar wrote: > get_preempt_count() is enabled to return preempt_count for powerpc, > so that bpf_in_interrupt()/bpf_in_nmi()/bpf_in_serving_softirq()/ > bpf_in_task()/bpf_in_hardirq()/get_preempt_count() works for > powerpc as well. > > Signed-off-by: Saket Kumar Bhaskar > --- > Changes since v1: > * Updated the comments to include powerpc for the APIs. > > v1: https://lore.kernel.org/bpf/20260129054035.168078-1-skb99@linux.ibm.com/ > --- > tools/testing/selftests/bpf/bpf_experimental.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h > index 4b7210c318dd..9df77e59d4f5 100644 > --- a/tools/testing/selftests/bpf/bpf_experimental.h > +++ b/tools/testing/selftests/bpf/bpf_experimental.h > @@ -645,6 +645,8 @@ static inline int get_preempt_count(void) > bpf_this_cpu_ptr(&pcpu_hot))->preempt_count; > #elif defined(bpf_target_arm64) > return bpf_get_current_task_btf()->thread_info.preempt.count; > +#elif defined(bpf_target_powerpc) > + return bpf_get_current_task_btf()->thread_info.preempt_count; > #endif Maybe do #elif defined(bpf_target_arm64) || defined(bpf_target_powerpc) ? > return 0; > } > @@ -653,6 +655,7 @@ static inline int get_preempt_count(void) > * Report whether it is in interrupt context. Only works on the following archs: > * * x86 > * * arm64 > + * * powerpc64 > */ > static inline int bpf_in_interrupt(void) > { > @@ -672,6 +675,7 @@ static inline int bpf_in_interrupt(void) > * Report whether it is in NMI context. Only works on the following archs: > * * x86 > * * arm64 > + * * powerpc64 > */ > static inline int bpf_in_nmi(void) > { > @@ -682,6 +686,7 @@ static inline int bpf_in_nmi(void) > * Report whether it is in hard IRQ context. Only works on the following archs: > * * x86 > * * arm64 > + * * powerpc64 > */ > static inline int bpf_in_hardirq(void) > { > @@ -692,6 +697,7 @@ static inline int bpf_in_hardirq(void) > * Report whether it is in softirq context. Only works on the following archs: > * * x86 > * * arm64 > + * * powerpc64 > */ > static inline int bpf_in_serving_softirq(void) > { > @@ -710,6 +716,7 @@ static inline int bpf_in_serving_softirq(void) > * Report whether it is in task context. Only works on the following archs: > * * x86 > * * arm64 > + * * powerpc64 > */ > static inline int bpf_in_task(void) > {