From patchwork Wed Jun 23 11:07:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 12339623 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5856C49EAB for ; Wed, 23 Jun 2021 11:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B18B561166 for ; Wed, 23 Jun 2021 11:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230252AbhFWLK0 (ORCPT ); Wed, 23 Jun 2021 07:10:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29898 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbhFWLJ7 (ORCPT ); Wed, 23 Jun 2021 07:09:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624446461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yDyNUpCpBTNbFxDC2WQuaaPWytT5QLCtZC1t66JXAlk=; b=HghLPu/6cLfRJgCvUyZzMOADyhneoMvrhonyjKx80rLTAMV6oU+GkJXwUsfia9QAri9Z0C elBNp6vGPEVoBoHgMMTHGVC0lcOAgCfkUqn6yE5YnkG4nTcsfDWn3PPBLnyMlPNJghQysu WhkjVVhuTq/GLcdXO5n3tktchYQfeDA= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-520-fhR4XsQCPGO1yRcJOOnsWQ-1; Wed, 23 Jun 2021 07:07:40 -0400 X-MC-Unique: fhR4XsQCPGO1yRcJOOnsWQ-1 Received: by mail-ej1-f71.google.com with SMTP id w13-20020a170906384db02903d9ad6b26d8so868253ejc.0 for ; Wed, 23 Jun 2021 04:07:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yDyNUpCpBTNbFxDC2WQuaaPWytT5QLCtZC1t66JXAlk=; b=JOhsKZkjRfAyVKbShHJTGIxM1CMV27Qnm570q5S6bwWnphrSgm0vuytZn4wiircp+q luVBrXqE3q0QYfB+1JlvZEVX9yAuoB1i+PRXUvtBZrW76C/XKBQO8cR4pRhd4c6clR+o rkslEFQOSWpjZxxQcVTjJCoEq6XQ6aMziXChraj3p6fAfQgNkS5+l3OedlZKN6bk8rtw /RxReMMqdcyeZ5yWYHIlLOqwA4LhGoRGe4BnI2nSgxwaXckfDbm0PKZWFPPFI94b3aIm 1yaosShK4vrbyUzhD1xmTD7YKlH30Zjrf4aC29+7YPAEXs9+yQplRRjMQDdJSaphZCZJ ojbw== X-Gm-Message-State: AOAM5328tNlg96wUTIyMfLxCK1MjyoIQyyf/VqFQE7zjC8mH0mgVXP3m CP+g7B75++Bb72KyW7pSQ46H5YlSLVOCQzIOmIWTe7A65welw1ZRl6tSQ3YEdbo4bZZSw30kttE TRpzSFoIXY+pP X-Received: by 2002:a17:906:841a:: with SMTP id n26mr9052465ejx.430.1624446458600; Wed, 23 Jun 2021 04:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiCn+E0GqnflDNDr2cZUSBElhE9Z+SzSMhk9zf2y/FqN45sosWDLQuM6WRitS6qMnDZWcnwQ== X-Received: by 2002:a17:906:841a:: with SMTP id n26mr9052436ejx.430.1624446458285; Wed, 23 Jun 2021 04:07:38 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id j19sm3767903ejo.3.2021.06.23.04.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 04:07:37 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 804F0180741; Wed, 23 Jun 2021 13:07:28 +0200 (CEST) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: bpf@vger.kernel.org, netdev@vger.kernel.org Cc: Martin KaFai Lau , Hangbin Liu , Jesper Dangaard Brouer , Magnus Karlsson , "Paul E . McKenney" , Jakub Kicinski , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Jassi Brar , Ilias Apalodimas Subject: [PATCH bpf-next v4 17/19] netsec: remove rcu_read_lock() around XDP program invocation Date: Wed, 23 Jun 2021 13:07:25 +0200 Message-Id: <20210623110727.221922-18-toke@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210623110727.221922-1-toke@redhat.com> References: <20210623110727.221922-1-toke@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net The netsec driver has a rcu_read_lock()/rcu_read_unlock() pair around the full RX loop, covering everything up to and including xdp_do_flush(). This is actually the correct behaviour, but because it all happens in a single NAPI poll cycle (and thus under local_bh_disable()), it is also technically redundant. With the addition of RCU annotations to the XDP_REDIRECT map types that take bh execution into account, lockdep even understands this to be safe, so there's really no reason to keep the rcu_read_lock() around anymore, so let's just remove it. Cc: Jassi Brar Cc: Ilias Apalodimas Acked-by: Ilias Apalodimas Signed-off-by: Toke Høiland-Jørgensen --- drivers/net/ethernet/socionext/netsec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index dfc85cc68173..20d148c019d8 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -958,7 +958,6 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) xdp_init_buff(&xdp, PAGE_SIZE, &dring->xdp_rxq); - rcu_read_lock(); xdp_prog = READ_ONCE(priv->xdp_prog); dma_dir = page_pool_get_dma_dir(dring->page_pool); @@ -1069,8 +1068,6 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) } netsec_finalize_xdp_rx(priv, xdp_act, xdp_xmit); - rcu_read_unlock(); - return done; }