Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp532975lqh; Tue, 7 May 2024 06:53:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYgv1o8E5iofobC5rMmhmzWSkLTZ2/SmZlZoUcO8hx387zk7780Lt0+fiypjsCn9vzJdCw1MmdTIGEBVeN3r2VmfQpQjeER3aBaUB/pw== X-Google-Smtp-Source: AGHT+IFL6dftWqsyoorGdzCYjCbMzLsdBRgqH8ysFBuhV2kGUBj+90hoGagGJ0HvhXK87zJlsziW X-Received: by 2002:a17:907:809:b0:a59:db0f:6bd8 with SMTP id wv9-20020a170907080900b00a59db0f6bd8mr6075399ejb.3.1715090003839; Tue, 07 May 2024 06:53:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715090003; cv=pass; d=google.com; s=arc-20160816; b=Rld7cuxIL0HUkMnXj46n2z+ppkDDiAgsls4yqPypj+gE07U6eErt+kcTvnsBSvWC7z uXwwD1ZqkZXfOROtYH+Z8NA3TgSM7yTts6ezcuyyYA6iVp4UmMCVyxBsTb9kj5WGqeZt 1429uSyqx6JgaLXvvRXL6n13eJ7qN1AnIjArEd4YaGyiJWdrVGYG+Bdm9xFpFseoC29B //cOH6j1ShP9zXfifZpkM7v/Ut3rhhNWvsKC2srzu9Jlkyxiptw5Oxa+vpRUi7wq/38J /eYIGynUK90rz2Qqxyry/K3b2Uf79qtNjMoS1bb5HrDlC8ww2x0hbynzmr6R6sx6Lmj+ GOGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=xTODE9eHYN04ukhQbjsh3NfbLHwJO8ke2b2LYl5imOw=; fh=OoGDO0rNUPJ9rrapAHIiM7rSdZvSDaBrPRZXLbUm/N8=; b=WYSey/jpXrwXqG+PlfGIxoK8E48M1g46udubH51r2PBbQCuDVri0X4A8hAH5efZtzp AYmffZ3pTxR4RRsZTvAMA9Ya2oeRrzXwqGX/Tlm6u0w2AcME+S9oxk62cNO91Nh6R2X8 eEP3aSz7NC1IHHaHOzL/nc1mAXcYsIYEg2mN6p7FkZJYkR1Cb/90Q/BPKripuKnJ0Uhy RkVZbbUf/Cd7avEOdnkf6UNinXgnVPU4DKW3IyA7uaB1jtgmbaAVzL3ImF8ebyEU62jP K/fvb88ZhqmfbrFuJW5DYPqSX0qf/pW1B/sClrgK5YCLe1moT6Wcd4b4MommdN1fiTsy oZ9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QmD0p47D; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id he15-20020a1709073d8f00b00a59c6ab79c1si2900731ejc.731.2024.05.07.06.53.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:53:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QmD0p47D; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id BFB511F2690E for ; Tue, 7 May 2024 13:52:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73C6915E7F5; Tue, 7 May 2024 13:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QmD0p47D" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 30C6A15E5D2 for ; Tue, 7 May 2024 13:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715089856; cv=none; b=Q2/zHsxoLJSDLQ6UcOGh94o7onCsfm4mLZZ5lea2FJ7flkZOvxq3Y8ykntlQkF0TytbaL8yqGKcmbYXrKB+RolkKQUvaGhF7k2QSUhR+rnRRAdJGaBzkgcCDo6whz45WHKCSnv5e1jr3YhbVStx1EFYmRsoUYKEtjdHwwmvhvlg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715089856; c=relaxed/simple; bh=TIJT24/Y/Kk/+RWnfVxsYYSG3i19tMA8dCXENC479kk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AApEq/zgpLJZfQqRhysywEgB0c3EJQzY2M90tAXP64m9w+klz6ubxEwWoZVJLLCdrHVTiNqrm+NSVicUuv+wnWjfLMFZy7t3ixw5mhX80HQSz9rORU9FPEYw6wSCaVF38EfOJNVDJT3D3uScc/hpXOhmJkq1oIiCu2rBnyOXsC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QmD0p47D; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715089854; 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: in-reply-to:in-reply-to:references:references; bh=xTODE9eHYN04ukhQbjsh3NfbLHwJO8ke2b2LYl5imOw=; b=QmD0p47DDS36/tfeC5lWnhS7wPjlFyFUuQuyQ1PUICB+0jCs5kc2Ebd7/bxnWYz0VFU+W4 CJ37UVS/Ci04hPYRuogNRpXfQ9385roCkttFjGzylYiZFArnv1g6XT2s0ohFbb9jyng0hH IYE14Semdk4ryGT7QMn8Ia+LOaAUoqg= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-dX8X3nD6PhiqEpoAJTwV_g-1; Tue, 07 May 2024 09:50:52 -0400 X-MC-Unique: dX8X3nD6PhiqEpoAJTwV_g-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-51f90454688so2568625e87.3 for ; Tue, 07 May 2024 06:50:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715089851; x=1715694651; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xTODE9eHYN04ukhQbjsh3NfbLHwJO8ke2b2LYl5imOw=; b=ncLbk+9lp7B8TwvsrxQzsYNzmTXP9DLpb2cIzDqhKgzHiuzUhwZ2jyak2+Xvy4qEOz llp29vDxmB0vvavDjxrEl0zRFilEkmRV4ZZC+3Ue1z3y8/c4je+t9kGW0p6KXcUZSV12 HKwl+BMuphrhwezMIvC/UCl2NpnoYbnf8l/BrykstbVSv7P3Ekjln6W1bwSdyQFK1Hdl yspeZAgwlmZbnLI/RNGtKV9GzgJ5upjUQN3lYPQwfwa5P3Zmgtao6chnGcBHgTCoA8/6 e0lpjP7YJr8W2pre+Cv1c6NJwXPiLgMINVEgcv3Ebhz79NayQ+T++csyHLv+O+QlQ3ZQ Fa+w== X-Gm-Message-State: AOJu0YyoBJYZx+026erVnCrr0fPNdeYW9HvWSVWAhyqN2qyvd/a5eEMz QpCEPSHz4nS2oLu/D66HADB2iEpwQjU0jsDK79RxSOwJ+hbrz5jY/PSTOajxHxjxcCrL+RY8XLq f+9f20NgqyX8/LWEqpwRf1kyupu7WyeG3wq/VxgDK5HMYo5gWoW7yUNFySmQVLA== X-Received: by 2002:a05:6512:1588:b0:518:b283:1078 with SMTP id bp8-20020a056512158800b00518b2831078mr14091445lfb.26.1715089851188; Tue, 07 May 2024 06:50:51 -0700 (PDT) X-Received: by 2002:a05:6512:1588:b0:518:b283:1078 with SMTP id bp8-20020a056512158800b00518b2831078mr14091422lfb.26.1715089850709; Tue, 07 May 2024 06:50:50 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id ek10-20020a056402370a00b00572033ec969sm6344723edb.60.2024.05.07.06.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:50:50 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 6C3FE1275DC8; Tue, 07 May 2024 15:50:49 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Boqun Feng , Daniel Borkmann , Eric Dumazet , Frederic Weisbecker , Ingo Molnar , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , Alexei Starovoitov , Andrii Nakryiko , Eduard Zingerman , Hao Luo , Jesper Dangaard Brouer , Jiri Olsa , John Fastabend , KP Singh , Martin KaFai Lau , Song Liu , Stanislav Fomichev , Yonghong Song , bpf@vger.kernel.org Subject: Re: [PATCH net-next 14/15] net: Reference bpf_redirect_info via task_struct on PREEMPT_RT. In-Reply-To: <20240507105731.bjCHl0YH@linutronix.de> References: <20240503182957.1042122-1-bigeasy@linutronix.de> <20240503182957.1042122-15-bigeasy@linutronix.de> <87y18mohhp.fsf@toke.dk> <20240507105731.bjCHl0YH@linutronix.de> X-Clacks-Overhead: GNU Terry Pratchett Date: Tue, 07 May 2024 15:50:49 +0200 Message-ID: <874jb9ohmu.fsf@toke.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Sebastian Andrzej Siewior writes: >> > +static inline struct bpf_redirect_info *bpf_net_ctx_get_ri(void) >> > +{ >> > + struct bpf_net_context *bpf_net_ctx = bpf_net_ctx_get(); >> > + >> > + if (!bpf_net_ctx) >> > + return NULL; >> >> ... do we really need all the NULL checks? >> >> (not just here, but in the code below as well). >> >> I'm a little concerned that we are introducing a bunch of new branches >> in the XDP hot path. Which is also why I'm asking for benchmarks :) > > We could hide the WARN behind CONFIG_DEBUG_NET. The only purpose is to > see the backtrace where the context is missing. Having just an error > somewhere will make it difficult to track. > > The NULL check is to avoid a crash if the context is missing. You could > argue that this should be noticed in development and never hit > production. If so, then we get the backtrace from NULL-pointer > dereference and don't need the checks and WARN. Yup, this (relying on the NULL deref) SGTM :) -Toke