Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp453869rdb; Tue, 16 Jan 2024 05:46:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMk53v8T6UKcHmxXBNAbEe7vvfIwWCse7S8B3liepuuih8tbFcRefzeqDT2pGDf4QTMQZb X-Received: by 2002:a05:6214:1256:b0:67f:453d:aa5 with SMTP id r22-20020a056214125600b0067f453d0aa5mr9584118qvv.67.1705412795075; Tue, 16 Jan 2024 05:46:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705412795; cv=none; d=google.com; s=arc-20160816; b=flHOHpm80KA3z9+IoSBa5sqzZFwKzT2XwX0/5imvhniqEGIaj7z8g6j2s0Z1OmxI1w EDpVfKXlSf3lSv/8cTPV26ZMNcNGwWnpG0M1F0z1vlM76VeHuENDFSjvZ2sCJeGXVJJ9 cLrLMlG8PyybSQraeWwDiq11/mW4QbI5la92nnlnFYhQdQ65E3DQAERPS/Cli/Ha/PWx iJvEW5p4CXaLdK1P/2lkgg10OO8g/ghaDYeDNl2Pt8g7vuBUYJP0UsU5Y2DyAC0PS4qF gz+J9mROqx+5pVbK0VA9yxy0qByVIyhts6v8G3j9n1VEAGoCf4KuZ6dBkYcL0HIlwLOE +aaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=nDn9a9+8eBGJue1T2bkBGdfLSF9RM9C3tmVFSM1THyo=; fh=0j9hEtKEGSulx/lgeQcpDl+4ujiVFr5DCPGOZLIRfAc=; b=aai8rVvp8fjQTrEUSH0qyHfUsQb7nPSokgK/Q8foQzwEMOp4ptOgGSWyw/dJZ0GNt+ 2fU+TrIrhLfLQXxxOkrbke+YaU5YaLpPVanMFbTN2oTz/f/T+C37yEGoeyvpw8MKCVdC gJPS0LidBtZnnqrOPwTOhFeprXr0RgF0Vw03ajB4CurUG4Fv1C6pGCkrK/cLjvDTTq5B iJlUJjEyJveHnCcUJ+KFna9tQzsRmJ03RJT1Aqr+FemHUaZY7z+ZvP8rshwU0fAInDPf hwsyDTONcSH1hTBSMJdO5b8qZcb+LHx2HYPKud+B/ozd7cg3TxGOKnecQ6Qh0tyD2GIw hu9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a1-20020a0ce341000000b00680f70d3985si9834315qvm.110.2024.01.16.05.46.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 05:46:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D03171C233E5 for ; Tue, 16 Jan 2024 13:46:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F4681BDE3; Tue, 16 Jan 2024 13:46:22 +0000 (UTC) Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) (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 033711B944; Tue, 16 Jan 2024 13:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=alibuda@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0W-mKldk_1705412774; Received: from 30.221.145.228(mailfrom:alibuda@linux.alibaba.com fp:SMTPD_---0W-mKldk_1705412774) by smtp.aliyun-inc.com; Tue, 16 Jan 2024 21:46:15 +0800 Message-ID: <3a82adb1-c839-4e82-834f-a63f9910b28d@linux.alibaba.com> Date: Tue, 16 Jan 2024 21:46:14 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC nf-next v5 0/2] netfilter: bpf: support prog update Content-Language: en-US From: "D. Wythe" To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, coreteam@netfilter.org, netfilter-devel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org References: <1704175877-28298-1-git-send-email-alibuda@linux.alibaba.com> In-Reply-To: <1704175877-28298-1-git-send-email-alibuda@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Just a reminder to avoid forgetting this patch by everyone. ???? Best wishes, D. Wythe On 1/2/24 2:11 PM, D. Wythe wrote: > From: "D. Wythe" > > This patches attempt to implements updating of progs within > bpf netfilter link, allowing user update their ebpf netfilter > prog in hot update manner. > > Besides, a corresponding test case has been added to verify > whether the update works. > -- > v1: > 1. remove unnecessary context, access the prog directly via rcu. > 2. remove synchronize_rcu(), dealloc the nf_link via kfree_rcu. > 3. check the dead flag during the update. > -- > v1->v2: > 1. remove unnecessary nf_prog, accessing nf_link->link.prog in direct. > -- > v2->v3: > 1. access nf_link->link.prog via rcu_dereference_raw to avoid warning. > -- > v3->v4: > 1. remove mutex for link update, as it is unnecessary and can be replaced > by atomic operations. > -- > v4->v5: > 1. fix error retval check on cmpxhcg > > D. Wythe (2): > netfilter: bpf: support prog update > selftests/bpf: Add netfilter link prog update test > > net/netfilter/nf_bpf_link.c | 50 ++++++++----- > .../bpf/prog_tests/netfilter_link_update_prog.c | 83 ++++++++++++++++++++++ > .../bpf/progs/test_netfilter_link_update_prog.c | 24 +++++++ > 3 files changed, 141 insertions(+), 16 deletions(-) > create mode 100644 tools/testing/selftests/bpf/prog_tests/netfilter_link_update_prog.c > create mode 100644 tools/testing/selftests/bpf/progs/test_netfilter_link_update_prog.c >