Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp149853rdb; Tue, 5 Dec 2023 01:04:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIliTtlqT3PPB92WDvEasYHLKUoH1C/FtdzgpsdQ7zmmjfAHoF2Kh7t5pinA61jWRM58ag X-Received: by 2002:a05:6a21:1496:b0:18c:f42c:d558 with SMTP id od22-20020a056a21149600b0018cf42cd558mr5517747pzb.28.1701767041769; Tue, 05 Dec 2023 01:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701767041; cv=none; d=google.com; s=arc-20160816; b=o5CkNLpH4YIk7PTcKsX3jdZyPDXUFHzyHL7eZBwilYlYaOpmTESTyBN1/LzGKcIOGM xY53oyXH1PXnd8aAd23+p+lYAjDk+KpyJat6GEx8CVF5p1AMi2L0WAkjBbCm2dNewOCB KA5GU1/l3syCFF/sFupmsPtDyqq7g5ZQx45emsdFdDoalPafTONttbCzmRBopxW9jx9l QTkcRzz7t2zonyie04//8f2KmS3UJORhLTH/H/KO2aFZoSjhHHgUxzagG/KodF+M5Z6P yIhYaxHN3GS13pidG0ln1gJvUAZXmb/hbB4baFsSL18rl1/AYd9PG4kEFSnXMKrRRcCh aEcw== 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=yrBMYfFc+7psr6y2xtQ4cvLevpqXl5CZRBrVSMY5Aaw=; fh=Db27VihW5Tby++LHCMGglIT5dy5t2kh+NCUx9ODM9wE=; b=yMCxm4StaCMpu0ibhy60X1h4Ae7SgKMB5/NTB0AdxoJCiT7BO7qw8j63qVQ3MfU5vK tiZqa8BKtKL4BGMZq2uor9KlIqf9wgjjVF1+H/8WJ1mNCfCjYl31k/rx9Jeg0xWj/9LX H81dshqcM1Dq+ixX4N/mJrjW5RKoUD0Ce3u2bEt0PaEQPniybYBNNV20PaIiC+Bj4jUl Gq2uASNVSHdbZJgp5eMVhTPiju8SDhQc7mibMfQuY3fmEqFESlw3vmUfNoKliwFy0CwG qGN8xUpCK3HRVH8xmyX5/paE00jMahyqr0YtwiV185OAtWjiq9jbsuvmR5q3V/eT90Ds 12eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DUAVM+3b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id d3-20020a63ed03000000b005a9fb6bf73esi9157919pgi.293.2023.12.05.01.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 01:04:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DUAVM+3b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 633ED804C621; Tue, 5 Dec 2023 01:03:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234872AbjLEJDj (ORCPT + 99 others); Tue, 5 Dec 2023 04:03:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbjLEJDi (ORCPT ); Tue, 5 Dec 2023 04:03:38 -0500 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD15120; Tue, 5 Dec 2023 01:03:44 -0800 (PST) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-da34f90f6e3so533404276.0; Tue, 05 Dec 2023 01:03:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701767023; x=1702371823; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yrBMYfFc+7psr6y2xtQ4cvLevpqXl5CZRBrVSMY5Aaw=; b=DUAVM+3bqNPPhEqWnBXwyXaSjXFWBzsYKsivbUA4AnpZ+5lL3jLkzVZnzRgXJznV/c 0/rmuWfi3i7Py7R2/oN/Vd7BdIfnGfbMrmmVnN3mZAM4cm5pckHjvzzyn7qVuLYlJ1Am 3oASudddx1qZkYbWYPydVx1cZTpqaaKtNAFKe21ACQg+BxvGFPXJ0g4eV54VZ2K/ePkZ HbDbm+yB9YVXzMxL6Cj7Ku+MNirlXlmstmM43zg347fFGYqUUucne7DnSf3WsQXqAu57 KODpAb07SfueBhMFiCKys11co2Oy5/Bjp0JOtam5iubZ07wOYd4LxfY3tC3WBlMOTw2A kHdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701767023; x=1702371823; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yrBMYfFc+7psr6y2xtQ4cvLevpqXl5CZRBrVSMY5Aaw=; b=l4G8K0D7MUiUhzmBvnUok2YoOZFJ9I7sohE3fAUMUf5GB7ow9pmtl0Ff6tBh7kCuuo CS5b7vZYTSbAG+8IwUHDzXcFxellgAaizJFhR2X3c4BnqUvD++O5r46WLwdOa2Prk9Ir smlPo23OXx/pjInB9eKUvZaskpyikIlcuj/nDOHylhvreFkfXCn50ucz7TTauAQSxr5E bWltYEWDSlf32DC8JqYUlPBQ9Y/miAdFbpL1lTVmxo7kOiXsA79/Ppk0y2glS2W3zJnr 3LUD1Nr31i9vGUHElhvOAtcz4zeNczfGTKb4wHHsO/KNpm74HeDldXOp7y4Uss3t4yKu ZNMg== X-Gm-Message-State: AOJu0YwE9odkZngnFJsXAmM9fBYFVMwldgRQidDBjnYMfPZYafToBI7c 9Ky8S1Ag1gwXE06kdct4bWAtAB9DdAhYf9QKzRE= X-Received: by 2002:a25:ae02:0:b0:db5:49d7:1c3b with SMTP id a2-20020a25ae02000000b00db549d71c3bmr8643178ybj.1.1701767023286; Tue, 05 Dec 2023 01:03:43 -0800 (PST) MIME-Version: 1.0 References: <20231201061048.GA1510@libra05> In-Reply-To: <20231201061048.GA1510@libra05> From: Magnus Karlsson Date: Tue, 5 Dec 2023 10:03:32 +0100 Message-ID: Subject: Re: [PATCH bpf] xsk: skip polling event check for unbound socket To: Yewon Choi Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, threeearcat@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 05 Dec 2023 01:03:59 -0800 (PST) On Fri, 1 Dec 2023 at 07:11, Yewon Choi wrote: > > In xsk_poll(), checking available events and setting mask bits should > be executed only when a socket has been bound. Setting mask bits for > unbound socket is meaningless. > Currently, it checks events even when xsk_check_common() failed. > To prevent this, we move goto location (skip_tx) after that checking. Thanks for the fix. Acked-by: Magnus Karlsson > Fixes: 1596dae2f17e ("xsk: check IFF_UP earlier in Tx path") > Signed-off-by: Yewon Choi > --- > net/xdp/xsk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index ae9f8cb611f6..1e5a65326d1d 100644 > --- a/net/xdp/xsk.c > +++ b/net/xdp/xsk.c > @@ -947,7 +947,7 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock, > > rcu_read_lock(); > if (xsk_check_common(xs)) > - goto skip_tx; > + goto out; > > pool = xs->pool; > > @@ -959,12 +959,12 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock, > xsk_generic_xmit(sk); > } > > -skip_tx: > if (xs->rx && !xskq_prod_is_empty(xs->rx)) > mask |= EPOLLIN | EPOLLRDNORM; > if (xs->tx && xsk_tx_writeable(xs)) > mask |= EPOLLOUT | EPOLLWRNORM; > > +out: > rcu_read_unlock(); > return mask; > } > -- > 2.37.3 > >