Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5233146rwb; Mon, 31 Jul 2023 21:56:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHSkPl2v8VmKF3aFnYjNoxnVwXIaSfWk7Tx+3i59t4HtCoKQNktCsFKbG6E7M//TII7Rqsi X-Received: by 2002:aa7:c706:0:b0:522:7ab4:31fe with SMTP id i6-20020aa7c706000000b005227ab431femr1486617edq.23.1690865767318; Mon, 31 Jul 2023 21:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690865767; cv=none; d=google.com; s=arc-20160816; b=XTTcIdZ6HJpFhcAqyKkR5Nv+qoQBIBinMYYj6cqcP4GmqhH4cnFKzq+fVC0uRZKy26 WVUe0Q+vfIq3B1oKdq9deR7xMDhZrUgFEf9hYg223QKdEPIFjcixfs9yIqMF00ClLp+v imcbN4alul/ZXuo8/K9SpYl5eyGLIbOcrnXtaQ0zjHZVaQpIb5dilCtTYhSkJoUzvOBc iGVelf4fa/S0ut00FcM7ho2d/yrB3s/0nHE7KXMvmqnaU3px//t9DrHboCA7Ha2/eNx/ pDxd3klNDEIV14iTU6w7AmeuqcQZXwzFH7gyosC+3bZSJj0SCHyXQ9SCxprCc2ReY8PJ +Lbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:subject :references:in-reply-to:message-id:cc:to:from:date:dkim-signature; bh=Am6kUc1gFEEL40tXojHcI3O9SLUldvAEmwslcqO3ZMY=; fh=pTsksVuJ1gSiuKl2r+vfJcD4W5PP/Z/NduhrCmuO1UM=; b=S/i6JPnlrWhxIGKho56XEpytVrBvJ2wbe9IkxtIp00z9D7jDR4yeoqfvGuqHffP1Hg xE7MxlF1Tk91VU5P2IGdE8cOwRZXwyqSApJu91dvfiZu60HsxG30YCIH+vimd2RQOOxw rkkerodFRfNzLbG0ST+Zy3FUhUfd9h33ke/g+FcwyYweRZu14Ik/yHf029lCEqEhsmqZ HyzGnaKPGo1CL/9pE67j8VxSIG/9Izca09GLQ1g1NzodxfMftrbUs99DTrOlSSF7d1ph 7SxmmjPinGecdhA4D2gE1uQ7zZO5IrAxDcg7f5XfV21EoogYsvuE87rKuXnr9l34gSym l87A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RxgbSzYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u23-20020a05640207d700b005221f09dde5si3671112edy.67.2023.07.31.21.55.43; Mon, 31 Jul 2023 21:56:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RxgbSzYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbjHAD7Q (ORCPT + 99 others); Mon, 31 Jul 2023 23:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbjHAD7J (ORCPT ); Mon, 31 Jul 2023 23:59:09 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D299173F; Mon, 31 Jul 2023 20:58:56 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-686f0d66652so4963006b3a.2; Mon, 31 Jul 2023 20:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690862335; x=1691467135; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Am6kUc1gFEEL40tXojHcI3O9SLUldvAEmwslcqO3ZMY=; b=RxgbSzYibpT3RWg1jhG3KETydqYw/5JtWpI4tu1YKbB2Kp0I3liS7rF4kEbelG2LiY NwyBQOioD2j0VAcRYep61Jtblhp1WpP+r+A8hbJgWKnQZ7CfzpQ/KPcugFIb79+SsxXq tBfzFBO5zJuva4FTVNFjO7Pn4AY1Zp39msFIDm2hdTi1u6YOPjZIrduytsOQdIThOLHz EsoZyK7xE7Ve5ENs7XKAn3ci8pobH3lp40257pkiwHWbwCyjMWnuKkM01dWGFqEkXNnm 1+bfLJzgk5K1a5QLeBs27GO1u9NEM1MPsO7U6m0p9IdZ6rWgAuDF19sDh48WhR8Gxlcb jAIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690862335; x=1691467135; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Am6kUc1gFEEL40tXojHcI3O9SLUldvAEmwslcqO3ZMY=; b=bYsxS99kU04bWQrH6BFFEQfplXbppf1rN2fqch0grvZnCn6Qs4lcDBAW/jKyojuqUr Q0IEymJTy2oxfLWnDD23GpGJezelZDg7cX9uo4TKswxIS0mlR03ysW/Fsgf4KB25FEJO pGTJiJ42mX9zQOwd0GDcA+ryVK58RIbf7wOuekwGwVJgDK45SpXKikmrfueRu3dprGgy WISEnU/tmncaRJZtqyZqmaYZUxvXqjFdTdEZBLDXM19JKLeyUIm2lSYrdtV9fsuFDrat vEjz1zXjf6H3ZUuVieo0MyRl5GtgE8MUv9HNnIHcB315qZA2/SOodwCQor8h7oA8CuVE h5Vg== X-Gm-Message-State: ABy/qLZYumibl41S1Dpks4iKb/Vz7TnHgbt1qmgxw+UxZ6Nf2XRBkfe2 NFW0KVHh8/l+kwufu1NVMXQ= X-Received: by 2002:a05:6a20:9150:b0:138:64d4:b040 with SMTP id x16-20020a056a20915000b0013864d4b040mr14767219pzc.54.1690862335303; Mon, 31 Jul 2023 20:58:55 -0700 (PDT) Received: from localhost ([98.97.32.4]) by smtp.gmail.com with ESMTPSA id 21-20020aa79255000000b00686bb3acfc2sm8299822pfp.181.2023.07.31.20.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 20:58:54 -0700 (PDT) Date: Mon, 31 Jul 2023 20:58:53 -0700 From: John Fastabend To: Jakub Sitnicki , tglozar@redhat.com Cc: linux-kernel@vger.kernel.org, john.fastabend@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, bpf@vger.kernel.org Message-ID: <64c882fd8c200_a427920843@john.notmuch> In-Reply-To: <87ila0fn01.fsf@cloudflare.com> References: <20230728064411.305576-1-tglozar@redhat.com> <87ila0fn01.fsf@cloudflare.com> Subject: Re: [PATCH net] bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Jakub Sitnicki wrote: > > On Fri, Jul 28, 2023 at 08:44 AM +02, tglozar@redhat.com wrote: > > From: Tomas Glozar > > > > Disabling preemption in sock_map_sk_acquire conflicts with GFP_ATOMIC > > allocation later in sk_psock_init_link on PREEMPT_RT kernels, since > > GFP_ATOMIC might sleep on RT (see bpf: Make BPF and PREEMPT_RT co-exist > > patchset notes for details). > > > > This causes calling bpf_map_update_elem on BPF_MAP_TYPE_SOCKMAP maps to > > BUG (sleeping function called from invalid context) on RT kernels. > > > > preempt_disable was introduced together with lock_sk and rcu_read_lock > > in commit 99ba2b5aba24e ("bpf: sockhash, disallow bpf_tcp_close and update > > in parallel"), probably to match disabled migration of BPF programs, and > > is no longer necessary. > > > > Remove preempt_disable to fix BUG in sock_map_update_common on RT. > > > > Signed-off-by: Tomas Glozar > > --- > > We disable softirq and hold a spin lock when modifying the map/hash in > sock_{map,hash}_update_common so this LGTM: > Agree. > Reviewed-by: Jakub Sitnicki Reviewed-by: John Fastabend > > You might want some extra tags: > > Link: https://lore.kernel.org/all/20200224140131.461979697@linutronix.de/ > Fixes: 99ba2b5aba24 ("bpf: sockhash, disallow bpf_tcp_close and update in parallel")