* [PATCH 0/1] bpf: avoid unnecessary IPI in bpf_flush_icache
@ 2021-06-01 15:06 Yanfei Xu
2021-06-01 15:06 ` [PATCH 1/1] " Yanfei Xu
0 siblings, 1 reply; 7+ messages in thread
From: Yanfei Xu @ 2021-06-01 15:06 UTC (permalink / raw)
To: daniel, ast, zlim.lnx, catalin.marinas, will, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh
Cc: netdev, bpf, linux-arm-kernel, linux-kernel
Hi,
When looking at the IPI counts in /proc/interrupts, there are always
IPI1 happened on isolated cpus, even if the cpus had been idle with
nohz. However, we should bother these cpus as less as possible.
The IPI1 were raised by flush_icache_range in bpf_int_jit_compile().
Futher, the calling of it was introduced in 3b8c9f1cdfc5("arm64:
IPI each CPU after invalidating the I-cache for kernel mappings"),
then I found the bpf case seems no need this operation. But I'm not
sure, and still learning the JIT codes meanwhile. If I am wrong,
please fix me, many thanks!
Yanfei Xu (1):
bpf: avoid unnecessary IPI in bpf_flush_icache
arch/arm64/net/bpf_jit_comp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.27.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/1] bpf: avoid unnecessary IPI in bpf_flush_icache
2021-06-01 15:06 [PATCH 0/1] bpf: avoid unnecessary IPI in bpf_flush_icache Yanfei Xu
@ 2021-06-01 15:06 ` Yanfei Xu
2021-06-01 17:20 ` Daniel Borkmann
0 siblings, 1 reply; 7+ messages in thread
From: Yanfei Xu @ 2021-06-01 15:06 UTC (permalink / raw)
To: daniel, ast, zlim.lnx, catalin.marinas, will, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh
Cc: netdev, bpf, linux-arm-kernel, linux-kernel
It's no need to trigger IPI for keeping pipeline fresh in bpf case.
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
---
arch/arm64/net/bpf_jit_comp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index f7b194878a99..5311f8be4ba4 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -974,7 +974,7 @@ static int validate_code(struct jit_ctx *ctx)
static inline void bpf_flush_icache(void *start, void *end)
{
- flush_icache_range((unsigned long)start, (unsigned long)end);
+ __flush_icache_range((unsigned long)start, (unsigned long)end);
}
struct arm64_jit_data {
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bpf: avoid unnecessary IPI in bpf_flush_icache
2021-06-01 15:06 ` [PATCH 1/1] " Yanfei Xu
@ 2021-06-01 17:20 ` Daniel Borkmann
2021-06-01 17:41 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Borkmann @ 2021-06-01 17:20 UTC (permalink / raw)
To: Yanfei Xu, ast, zlim.lnx, catalin.marinas, will, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh
Cc: netdev, bpf, linux-arm-kernel, linux-kernel
On 6/1/21 5:06 PM, Yanfei Xu wrote:
> It's no need to trigger IPI for keeping pipeline fresh in bpf case.
This needs a more concrete explanation/analysis on "why it is safe" to do so
rather than just saying that it is not needed.
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
> arch/arm64/net/bpf_jit_comp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
> index f7b194878a99..5311f8be4ba4 100644
> --- a/arch/arm64/net/bpf_jit_comp.c
> +++ b/arch/arm64/net/bpf_jit_comp.c
> @@ -974,7 +974,7 @@ static int validate_code(struct jit_ctx *ctx)
>
> static inline void bpf_flush_icache(void *start, void *end)
> {
> - flush_icache_range((unsigned long)start, (unsigned long)end);
> + __flush_icache_range((unsigned long)start, (unsigned long)end);
> }
>
> struct arm64_jit_data {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bpf: avoid unnecessary IPI in bpf_flush_icache
2021-06-01 17:20 ` Daniel Borkmann
@ 2021-06-01 17:41 ` Will Deacon
2021-06-02 11:26 ` Xu, Yanfei
0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2021-06-01 17:41 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Yanfei Xu, ast, zlim.lnx, catalin.marinas, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev, bpf,
linux-arm-kernel, linux-kernel
On Tue, Jun 01, 2021 at 07:20:04PM +0200, Daniel Borkmann wrote:
> On 6/1/21 5:06 PM, Yanfei Xu wrote:
> > It's no need to trigger IPI for keeping pipeline fresh in bpf case.
>
> This needs a more concrete explanation/analysis on "why it is safe" to do so
> rather than just saying that it is not needed.
Agreed. You need to show how the executing thread ends up going through a
context synchronizing operation before jumping to the generated code if
the IPI here is removed.
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bpf: avoid unnecessary IPI in bpf_flush_icache
2021-06-01 17:41 ` Will Deacon
@ 2021-06-02 11:26 ` Xu, Yanfei
2021-06-02 17:26 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: Xu, Yanfei @ 2021-06-02 11:26 UTC (permalink / raw)
To: Will Deacon, Daniel Borkmann
Cc: ast, zlim.lnx, catalin.marinas, andrii, kafai, songliubraving,
yhs, john.fastabend, kpsingh, netdev, bpf, linux-arm-kernel,
linux-kernel
On 6/2/21 1:41 AM, Will Deacon wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Tue, Jun 01, 2021 at 07:20:04PM +0200, Daniel Borkmann wrote:
>> On 6/1/21 5:06 PM, Yanfei Xu wrote:
>>> It's no need to trigger IPI for keeping pipeline fresh in bpf case.
>>
>> This needs a more concrete explanation/analysis on "why it is safe" to do so
>> rather than just saying that it is not needed.
>
> Agreed. You need to show how the executing thread ends up going through a
> context synchronizing operation before jumping to the generated code if
> the IPI here is removed.
This patch came out with I looked through ftrace codes. Ftrace modify
the text code and don't send IPI in aarch64_insn_patch_text_nosync(). I
mistakenly thought the bpf is same with ftrace.
But now I'm still not sure why the ftrace don't need the IPI to go
through context synchronizing, maybe the worst situation is omit a
tracing event?
Thanks,
Yanfei
>
> Will
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bpf: avoid unnecessary IPI in bpf_flush_icache
2021-06-02 11:26 ` Xu, Yanfei
@ 2021-06-02 17:26 ` Will Deacon
2021-06-03 10:29 ` Xu, Yanfei
0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2021-06-02 17:26 UTC (permalink / raw)
To: Xu, Yanfei
Cc: Daniel Borkmann, ast, zlim.lnx, catalin.marinas, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev, bpf,
linux-arm-kernel, linux-kernel
On Wed, Jun 02, 2021 at 07:26:03PM +0800, Xu, Yanfei wrote:
>
>
> On 6/2/21 1:41 AM, Will Deacon wrote:
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > On Tue, Jun 01, 2021 at 07:20:04PM +0200, Daniel Borkmann wrote:
> > > On 6/1/21 5:06 PM, Yanfei Xu wrote:
> > > > It's no need to trigger IPI for keeping pipeline fresh in bpf case.
> > >
> > > This needs a more concrete explanation/analysis on "why it is safe" to do so
> > > rather than just saying that it is not needed.
> >
> > Agreed. You need to show how the executing thread ends up going through a
> > context synchronizing operation before jumping to the generated code if
> > the IPI here is removed.
>
> This patch came out with I looked through ftrace codes. Ftrace modify
> the text code and don't send IPI in aarch64_insn_patch_text_nosync(). I
> mistakenly thought the bpf is same with ftrace.
>
> But now I'm still not sure why the ftrace don't need the IPI to go
> through context synchronizing, maybe the worst situation is omit a
> tracing event?
I think ftrace handles this itself via ftrace_sync_ipi, no?
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bpf: avoid unnecessary IPI in bpf_flush_icache
2021-06-02 17:26 ` Will Deacon
@ 2021-06-03 10:29 ` Xu, Yanfei
0 siblings, 0 replies; 7+ messages in thread
From: Xu, Yanfei @ 2021-06-03 10:29 UTC (permalink / raw)
To: Will Deacon
Cc: Daniel Borkmann, ast, zlim.lnx, catalin.marinas, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev, bpf,
linux-arm-kernel, linux-kernel
On 6/3/21 1:26 AM, Will Deacon wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Wed, Jun 02, 2021 at 07:26:03PM +0800, Xu, Yanfei wrote:
>>
>>
>> On 6/2/21 1:41 AM, Will Deacon wrote:
>>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>>
>>> On Tue, Jun 01, 2021 at 07:20:04PM +0200, Daniel Borkmann wrote:
>>>> On 6/1/21 5:06 PM, Yanfei Xu wrote:
>>>>> It's no need to trigger IPI for keeping pipeline fresh in bpf case.
>>>>
>>>> This needs a more concrete explanation/analysis on "why it is safe" to do so
>>>> rather than just saying that it is not needed.
>>>
>>> Agreed. You need to show how the executing thread ends up going through a
>>> context synchronizing operation before jumping to the generated code if
>>> the IPI here is removed.
>>
>> This patch came out with I looked through ftrace codes. Ftrace modify
>> the text code and don't send IPI in aarch64_insn_patch_text_nosync(). I
>> mistakenly thought the bpf is same with ftrace.
>>
>> But now I'm still not sure why the ftrace don't need the IPI to go
>> through context synchronizing, maybe the worst situation is omit a
>> tracing event?
>
> I think ftrace handles this itself via ftrace_sync_ipi, no?
Ah, Yes! I missed this...
Anyway, thanks for your reminding and very sorry for my noise.
Regards,
Yanfei
>
> Will
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-03 10:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 15:06 [PATCH 0/1] bpf: avoid unnecessary IPI in bpf_flush_icache Yanfei Xu
2021-06-01 15:06 ` [PATCH 1/1] " Yanfei Xu
2021-06-01 17:20 ` Daniel Borkmann
2021-06-01 17:41 ` Will Deacon
2021-06-02 11:26 ` Xu, Yanfei
2021-06-02 17:26 ` Will Deacon
2021-06-03 10:29 ` Xu, Yanfei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).