X-Received: by 2002:a17:90b:164f:b0:1b9:19de:ef67 with SMTP id il15-20020a17090b164f00b001b919deef67mr2304210pjb.101.1645505832209; Mon, 21 Feb 2022 20:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645505832; cv=none; d=google.com; s=arc-20160816; b=OFcS6Hv/fjdLjYHTHoWqGFFKomSGCZzZSQ6AWkJVEkIvV+CBvY8jfi3w2llAEz6+bO HZFex4ZAokeyZTjGk16oPWbnwzj0hCubYHW7DKQawFmaUHmfSGeZm8Qd/YfqBRXsFTIe CMxWx5AheXVQ+krArqk1UUnxqcUlBBXCsaxvdKwSwAP5unhxnqyHVC6/PgxhIJg6stQs M86F9YosPdPA73jheQkR92VAf2FQ1GJs5xehxf5fDfZXlaqMWCwye3s+yKbAhz/uagOV GMXWu4FaQ3xfVA+uJHMt0Tu/EG7qz8sP04maaa/cLurkDw6NMLZOqQwSYRx0fQXeLpoI lb6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lJFW2Fq9ITAne+ZL3YHCfZhFsNkaeVIwNM0107qcH2E=; b=DJZy7q21uXkXK7pKFBif1yWwKJcMwkyEoWJLaXCWMhKAoSwRdtxWB989KhuwhHviCb J/ACel9iaonSkc/lia7S5O+wXq5yFBsEHqLlv1HjOuyZ4evo381b3ErCcW5ivrcUexba OCKS6B+5PXiaA3yPAmAfkUp+tYIgXiDbtlxUwBqTZkatd9gyknlBXaLkTwUrTWI146Jr zg8rotwjKjzUiD4QvkBIYFevLLpWZgyk6wC8jQAuHaO5EarziJf9ftTa1Q4EVZz02rhb OsC+zSYGd3YU+3S2HxMUXM3io3c9tm6JX6bs/1lsO1PSt6hApZ+3oNFhYWcoAkmFaxV6 wR7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aQ8vgFKT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lt22-20020a17090b355600b001bc328580e6si1014203pjb.155.2022.02.21.20.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:57:12 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aQ8vgFKT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9619F12AAA; Mon, 21 Feb 2022 20:34:20 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238899AbiBVCPB (ORCPT + 99 others); Mon, 21 Feb 2022 21:15:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbiBVCO7 (ORCPT ); Mon, 21 Feb 2022 21:14:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5121C12D; Mon, 21 Feb 2022 18:14:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1AB4AB817F8; Tue, 22 Feb 2022 02:14:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC38EC340E9; Tue, 22 Feb 2022 02:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645496072; bh=KqibIir4n8GGBG4Zyj0JQPp8upAMZezOjVYAX7/7D/0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aQ8vgFKTbc8fEzvCZvW4uEzI3uiFEVYJzqfbp2rdnhCvilW9QZM0/TeArOPfXbXcJ /cIaFHbE/s0Hthwoau49V7tNl0TjULHzQfZv8XR7lVf2lIENFi2+vI9qqhUr20I/LL cAiSHTgEPlKY/2U3WGeR2+wRpUPUyCdJh9Q00m/usPFsj4peijOXYpW/sRwagRAqJu NQsca5467UPgWyE3CJ0UlIZbLcs1shzIqcGFTyxJYYTkzKTaMdu/OR24wOIfeLhp/A jCitbecM9ejEuENjCjLc6ENKiwBYbKnNHr2PTIQHRwpnASt2BsGMEKZoW2wzos02/D Ml6z70n6nNcWQ== Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-2d6d0cb5da4so102904367b3.10; Mon, 21 Feb 2022 18:14:32 -0800 (PST) X-Gm-Message-State: AOAM531iVbQ9a6+NH5JSwH3QzSKwcJEAYE8D+vGTrb4HagcZ5Zz7KdzD YjChbEapVI1IlWfvPHCVVMEdRkJ9sdDRMVP4RF8= X-Received: by 2002:a81:9895:0:b0:2d7:7e75:9ba8 with SMTP id p143-20020a819895000000b002d77e759ba8mr3783733ywg.130.1645496071854; Mon, 21 Feb 2022 18:14:31 -0800 (PST) MIME-Version: 1.0 References: <1645240502-13398-1-git-send-email-yangtiezhu@loongson.cn> <1645240502-13398-3-git-send-email-yangtiezhu@loongson.cn> In-Reply-To: <1645240502-13398-3-git-send-email-yangtiezhu@loongson.cn> From: Song Liu Date: Mon, 21 Feb 2022 18:14:20 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 2/2] bpf: Make BPF_JIT_DEFAULT_ON selectable in Kconfig To: Tiezhu Yang Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Xuefeng Li , Networking , bpf , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Fri, Feb 18, 2022 at 7:15 PM Tiezhu Yang wrote: > > Currently, only x86, arm64 and s390 select ARCH_WANT_DEFAULT_BPF_JIT, > the other archs do not select ARCH_WANT_DEFAULT_BPF_JIT. On the archs > without ARCH_WANT_DEFAULT_BPF_JIT, if we want to set bpf_jit_enable to > 1 by default, the only way is to enable CONFIG_BPF_JIT_ALWAYS_ON, then > the users can not change it to 0 or 2, it seems bad for some users. We > can select ARCH_WANT_DEFAULT_BPF_JIT for those archs if it is proper, > but at least for now, make BPF_JIT_DEFAULT_ON selectable can give them > a chance. > > Additionally, with this patch, under !BPF_JIT_ALWAYS_ON, we can disable > BPF_JIT_DEFAULT_ON on the archs with ARCH_WANT_DEFAULT_BPF_JIT when make > menuconfig, it seems flexible for some developers. > > Signed-off-by: Tiezhu Yang > --- > kernel/bpf/Kconfig | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig > index cbf3f65..461ac60 100644 > --- a/kernel/bpf/Kconfig > +++ b/kernel/bpf/Kconfig > @@ -54,6 +54,7 @@ config BPF_JIT > config BPF_JIT_ALWAYS_ON > bool "Permanently enable BPF JIT and remove BPF interpreter" > depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT > + select BPF_JIT_DEFAULT_ON > help > Enables BPF JIT and removes BPF interpreter to avoid speculative > execution of BPF instructions by the interpreter. > @@ -63,8 +64,16 @@ config BPF_JIT_ALWAYS_ON > in failure. > > config BPF_JIT_DEFAULT_ON > - def_bool ARCH_WANT_DEFAULT_BPF_JIT || BPF_JIT_ALWAYS_ON > - depends on HAVE_EBPF_JIT && BPF_JIT > + bool "Defaultly enable BPF JIT and remove BPF interpreter" I think "remove BPF interpreter" is not accurate. I guess we can just say "Enable BPF JIT by default". (also "defaultly" sounds weird to me). > + default y if ARCH_WANT_DEFAULT_BPF_JIT > + depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT > + help > + Enables BPF JIT and removes BPF interpreter to avoid speculative > + execution of BPF instructions by the interpreter. > + > + When CONFIG_BPF_JIT_DEFAULT_ON is enabled but CONFIG_BPF_JIT_ALWAYS_ON > + is disabled, /proc/sys/net/core/bpf_jit_enable is set to 1 by default > + and can be changed to 0 or 2. > > config BPF_UNPRIV_DEFAULT_OFF > bool "Disable unprivileged BPF by default" > -- > 2.1.0 >