Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1176070imk; Sun, 3 Jul 2022 19:39:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ta5dnVS3Q3MXyJx+d/pgaDN9dTrV5bZlmm6/8iM7YCagXh+MckhOXwxVfK9F6TxLPR5wJx X-Received: by 2002:a17:906:77c8:b0:722:e753:fbbe with SMTP id m8-20020a17090677c800b00722e753fbbemr25527328ejn.692.1656902366776; Sun, 03 Jul 2022 19:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656902366; cv=none; d=google.com; s=arc-20160816; b=MXhtetf6F8rPZ008Rg5iYEQOVQBwt8Le6F4mV9/wwvcKMcsZDvQJlN/d+y/YFER23A PqliR4U48ZafeFYz5awjSxNQr5soI+2/JO9OCe61LPS7zKWcst7f+99n0pbuwepj0vSI dwQCHO5kxr72rY2Fe53cLg1ECwZKNi042j+STImjpjfkVT9I4Kt1N1GKdE+BOVNdp4Yq hYrxh1Gop2Z+66WZ2ggqbFe1ZxG5eSf2deNzARLkIcte3umD7pWzVc1SbRjWKBwaIP4i AemoQicCxuIQvt5KAuq0RMvga50Jv+3XJc0tte9a9+815FNqdXY0dnkALevW4xFpzBy9 hlFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=TZ5W8QZXDraWuzczqTT6St6RLx7J+VXKyQ1T64qeJU4=; b=KTFhVGdLm++VUDZ6JpgIUH7XI4Clg6kNDi/DvBl8FwJ7YCtdj4vetSOTpi4StQfRWf JNeua/fwbiQ9LKLPxe97cjJeqSR+95QE1YiYx8xUN77JQCKoGuFrNphjapotKa244E+I pQOUlaQpEUB3XHl597FZOCRZ63laS9jxAD1kdfiWm5/Q6nhl05XO2IYpMm/MP/xt/M78 wLkAJc7Y05C2NSFECvX3iCa+AaRa21AOwtT32uJ+/RKoen2PfCaVx/gcPUdjC8Kx7vp2 BiJ0IAL6Wx/zlmFfm7PczkzEC5bYPorerrIo9iz06gegphmwBtPzqkHWaeixz+MMibDK Y/zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020aa7d745000000b0043a4d86c7d7si2321875eds.394.2022.07.03.19.39.01; Sun, 03 Jul 2022 19:39:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbiGDCU0 (ORCPT + 99 others); Sun, 3 Jul 2022 22:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiGDCUU (ORCPT ); Sun, 3 Jul 2022 22:20:20 -0400 Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C716353; Sun, 3 Jul 2022 19:20:19 -0700 (PDT) Date: Mon, 4 Jul 2022 10:20:05 +0800 From: Yixun Lan To: Conor Dooley Cc: Palmer Dabbelt , linux-riscv@lists.infradead.org, Paul Walmsley , Albert Ou , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH] RISC-V/bpf: Enable bpf_probe_read{, str}() Message-ID: References: <20220703130924.57240-1-dlan@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 > > 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