All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@gentoo.org>
To: Conor Dooley <mail@conchuod.ie>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	linux-riscv@lists.infradead.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH] RISC-V/bpf: Enable bpf_probe_read{, str}()
Date: Mon, 4 Jul 2022 10:20:05 +0800	[thread overview]
Message-ID: <YsJOVZU1gPo3KzdB@ofant> (raw)
In-Reply-To: <c373eec7-2cc4-a41d-916c-f073aba5494b@conchuod.ie>

Hi Conor Dooley:

On 14:12 Sun 03 Jul     , Conor Dooley wrote:
> On 03/07/2022 14:09, Yixun Lan wrote:
> > Enable this option to fix a bcc error in RISC-V platform
> > 
> > And, the error shows as follows:
> > 
> > ~ # runqlen
> > WARNING: This target JIT is not designed for the host you are running. \
> > If bad things happen, please choose a different -march switch.
> > bpf: Failed to load program: Invalid argument
> > 0: R1=ctx(off=0,imm=0) R10=fp0
> > 0: (85) call bpf_get_current_task#35          ; R0_w=scalar()
> > 1: (b7) r6 = 0                        ; R6_w=0
> > 2: (7b) *(u64 *)(r10 -8) = r6         ; R6_w=P0 R10=fp0 fp-8_w=00000000
> > 3: (07) r0 += 312                     ; R0_w=scalar()
> > 4: (bf) r1 = r10                      ; R1_w=fp0 R10=fp0
> > 5: (07) r1 += -8                      ; R1_w=fp-8
> > 6: (b7) r2 = 8                        ; R2_w=8
> > 7: (bf) r3 = r0                       ; R0_w=scalar(id=1) R3_w=scalar(id=1)
> > 8: (85) call bpf_probe_read#4
> > unknown func bpf_probe_read#4
> > processed 9 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
> > 
> > Traceback (most recent call last):
> >   File "/usr/lib/python-exec/python3.9/runqlen", line 187, in <module>
> >     b.attach_perf_event(ev_type=PerfType.SOFTWARE,
> >   File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 1228, in attach_perf_event
> >     fn = self.load_func(fn_name, BPF.PERF_EVENT)
> >   File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 522, in load_func
> >     raise Exception("Failed to load BPF program %s: %s" %
> > Exception: Failed to load BPF program b'do_perf_event': Invalid argument
> > 
> > Signed-off-by: Yixun Lan <dlan@gentoo.org>
> 
> Do you know what commit this fixes?
> Thanks,
> Conor.
> 

I think this is effectively broken for RISC-V 64 at the commit:
 0ebeea8ca8a4: bpf: Restrict bpf_probe_read{, str}() only to archs where they work

However, the bcc tools haven't got BPF support for RISC-V at that time,
so no one noticed it

I can add a Fixes tag if you think it's a proper way

> > ---
> >  arch/riscv/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 32ffef9f6e5b4..da0016f1be6ce 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -25,6 +25,7 @@ config RISCV
> >  	select ARCH_HAS_GIGANTIC_PAGE
> >  	select ARCH_HAS_KCOV
> >  	select ARCH_HAS_MMIOWB
> > +	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
> >  	select ARCH_HAS_PTE_SPECIAL
> >  	select ARCH_HAS_SET_DIRECT_MAP if MMU
> >  	select ARCH_HAS_SET_MEMORY if MMU

-- 
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55

WARNING: multiple messages have this Message-ID (diff)
From: Yixun Lan <dlan@gentoo.org>
To: Conor Dooley <mail@conchuod.ie>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	linux-riscv@lists.infradead.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH] RISC-V/bpf: Enable bpf_probe_read{, str}()
Date: Mon, 4 Jul 2022 10:20:05 +0800	[thread overview]
Message-ID: <YsJOVZU1gPo3KzdB@ofant> (raw)
In-Reply-To: <c373eec7-2cc4-a41d-916c-f073aba5494b@conchuod.ie>

Hi Conor Dooley:

On 14:12 Sun 03 Jul     , Conor Dooley wrote:
> On 03/07/2022 14:09, Yixun Lan wrote:
> > Enable this option to fix a bcc error in RISC-V platform
> > 
> > And, the error shows as follows:
> > 
> > ~ # runqlen
> > WARNING: This target JIT is not designed for the host you are running. \
> > If bad things happen, please choose a different -march switch.
> > bpf: Failed to load program: Invalid argument
> > 0: R1=ctx(off=0,imm=0) R10=fp0
> > 0: (85) call bpf_get_current_task#35          ; R0_w=scalar()
> > 1: (b7) r6 = 0                        ; R6_w=0
> > 2: (7b) *(u64 *)(r10 -8) = r6         ; R6_w=P0 R10=fp0 fp-8_w=00000000
> > 3: (07) r0 += 312                     ; R0_w=scalar()
> > 4: (bf) r1 = r10                      ; R1_w=fp0 R10=fp0
> > 5: (07) r1 += -8                      ; R1_w=fp-8
> > 6: (b7) r2 = 8                        ; R2_w=8
> > 7: (bf) r3 = r0                       ; R0_w=scalar(id=1) R3_w=scalar(id=1)
> > 8: (85) call bpf_probe_read#4
> > unknown func bpf_probe_read#4
> > processed 9 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
> > 
> > Traceback (most recent call last):
> >   File "/usr/lib/python-exec/python3.9/runqlen", line 187, in <module>
> >     b.attach_perf_event(ev_type=PerfType.SOFTWARE,
> >   File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 1228, in attach_perf_event
> >     fn = self.load_func(fn_name, BPF.PERF_EVENT)
> >   File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 522, in load_func
> >     raise Exception("Failed to load BPF program %s: %s" %
> > Exception: Failed to load BPF program b'do_perf_event': Invalid argument
> > 
> > Signed-off-by: Yixun Lan <dlan@gentoo.org>
> 
> Do you know what commit this fixes?
> Thanks,
> Conor.
> 

I think this is effectively broken for RISC-V 64 at the commit:
 0ebeea8ca8a4: bpf: Restrict bpf_probe_read{, str}() only to archs where they work

However, the bcc tools haven't got BPF support for RISC-V at that time,
so no one noticed it

I can add a Fixes tag if you think it's a proper way

> > ---
> >  arch/riscv/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 32ffef9f6e5b4..da0016f1be6ce 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -25,6 +25,7 @@ config RISCV
> >  	select ARCH_HAS_GIGANTIC_PAGE
> >  	select ARCH_HAS_KCOV
> >  	select ARCH_HAS_MMIOWB
> > +	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
> >  	select ARCH_HAS_PTE_SPECIAL
> >  	select ARCH_HAS_SET_DIRECT_MAP if MMU
> >  	select ARCH_HAS_SET_MEMORY if MMU

-- 
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-07-04  2:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-03 13:09 [PATCH] RISC-V/bpf: Enable bpf_probe_read{, str}() Yixun Lan
2022-07-03 13:09 ` Yixun Lan
2022-07-03 13:12 ` Conor Dooley
2022-07-03 13:12   ` Conor Dooley
2022-07-04  2:20   ` Yixun Lan [this message]
2022-07-04  2:20     ` Yixun Lan
2022-07-04  6:29     ` Conor.Dooley
2022-07-04  6:29       ` Conor.Dooley
2022-07-04  5:53 ` Christoph Hellwig
2022-07-04  5:53   ` Christoph Hellwig
2022-07-06  5:00   ` Andrii Nakryiko
2022-07-06  5:00     ` Andrii Nakryiko
2022-07-06  6:41     ` Yonghong Song
2022-07-06  6:41       ` Yonghong Song
2022-07-06  7:01       ` Christoph Hellwig
2022-07-06  7:01         ` Christoph Hellwig
2022-07-09  1:01         ` Yixun Lan
2022-07-09  1:01           ` Yixun Lan
2022-07-09  6:24           ` Christoph Hellwig
2022-07-09  6:24             ` Christoph Hellwig
2022-07-09  8:48             ` Yixun Lan
2022-07-09  8:48               ` Yixun Lan
2022-07-11  3:58               ` Christoph Hellwig
2022-07-11  3:58                 ` Christoph Hellwig
2022-07-06  7:00     ` Christoph Hellwig
2022-07-06  7:00       ` Christoph Hellwig
2022-07-08 22:22       ` Andrii Nakryiko
2022-07-08 22:22         ` Andrii Nakryiko
2022-07-09  6:25         ` Christoph Hellwig
2022-07-09  6:25           ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YsJOVZU1gPo3KzdB@ofant \
    --to=dlan@gentoo.org \
    --cc=andrii@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mail@conchuod.ie \
    --cc=netdev@vger.kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.