Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp785191rwb; Wed, 26 Jul 2023 02:53:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlEbL9uMGMXOUquj+30bcdzPv/gBHcReawiK/BIUPd/0U7ooPwq/VcNH2IysyQZSnffu8uRm X-Received: by 2002:a17:902:e5c3:b0:1b2:fa8:d9c9 with SMTP id u3-20020a170902e5c300b001b20fa8d9c9mr2061968plf.49.1690365197605; Wed, 26 Jul 2023 02:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690365197; cv=none; d=google.com; s=arc-20160816; b=zfqgY2WewsTdPt45S/qqGviP98M4m5SzbKaNTQvo9Re11Or7KF6CeVZFLiUcyu00MK eAqbUpQwoAKClKtcpj2kv4IbvyQkWoDUheuWZ9hJszLy3dkoSF0rTTHj56F1BASDNDGy qoTdBbR2K8PHZdXpdhtKOqltcDDU1nxJQX03EkRwXtosIEjLIftxwIOODUrYaxLHFhsM V3VPHDGEr3+S3MjF/tCva3W/PgHbjhjIDs/p77cNjBvy8k2jsgfifnOwPhX7pBrLtYxt JEgpoba29fQk+vstMecQKdu6r0oq1pFvk8+n1oA6vHWtCWMqh3bDSw6BkicsFwAt2ENY ItPg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=XtYwhjvqgWz9QjsOakEd2O0h4kwm2uV/DxKMgZHITXQ=; fh=qD7dBaqyiV9dIDUwNwmQ/qr1zOZ2URU0U6HZa3mhbK8=; b=sClv3epUGur++QCvBEUunQKxdVk8YwjC73A5G4BAnd97Ob2ZJhMZ7GBqTySfOM9IZm BC0RdZpEJGajhsmgHCo9Y4zTj/D6eB5L9VBfcQANt+gNi0riXs+IcRahDNq2Xpw1glHo zabTQp+070zyke4sg3q3VOEKqN9UmMemVgMA184KmegEkv2qLgAqfnACAZf/A0W0OJqj esEavh0Z9UrIEEwPcLx14WkGNiISyR1WiLbrR6jVHx12GeT7Apamz+8Xn1N9ivMlgjrM IfmRiqFtZaR4tg2Zqpln0YNkWJunICP6e+SWtiW8Z1k8GdcNX2DkAmbp4MQTeufiSqaT AnmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gR90ZHTs; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a170902ca0500b001bbc7ed95efsi1423917pld.44.2023.07.26.02.53.05; Wed, 26 Jul 2023 02:53:17 -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=@redhat.com header.s=mimecast20190719 header.b=gR90ZHTs; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231133AbjGZJBf (ORCPT + 99 others); Wed, 26 Jul 2023 05:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbjGZJBB (ORCPT ); Wed, 26 Jul 2023 05:01:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5387B448D for ; Wed, 26 Jul 2023 01:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690361745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XtYwhjvqgWz9QjsOakEd2O0h4kwm2uV/DxKMgZHITXQ=; b=gR90ZHTsIFPJbAg2V6QtHYtdEIqf2mztrfr0Mgys9KrMhyuyY0t/FSMznnqYIoC/FdnCJ5 UleAVqbAVPU/Q6qM/4fPFnhkhvDrswBoaCVTV7NFetsh8GE+y7msa1LmcZgi2YxDl9X7Ik EcWj1iqRLydknv2UFssVsyJgK70VqtA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-80--kpPVwcUMIqEd3se6Fhlag-1; Wed, 26 Jul 2023 04:55:42 -0400 X-MC-Unique: -kpPVwcUMIqEd3se6Fhlag-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE08D803470; Wed, 26 Jul 2023 08:55:41 +0000 (UTC) Received: from fedora.. (unknown [10.43.17.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A4754094DC0; Wed, 26 Jul 2023 08:55:40 +0000 (UTC) From: tglozar@redhat.com To: linux-kernel@vger.kernel.org Cc: john.fastabend@gmail.com, jakub@cloudflare.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, bpf@vger.kernel.org, Tomas Glozar Subject: [PATCH RFC net] bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire Date: Wed, 26 Jul 2023 10:50:03 +0200 Message-ID: <20230726085003.261112-1-tglozar@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") with no comment on why it is necessary. Remove preempt_disable to fix BUG in sock_map_update_common on RT. Signed-off-by: Tomas Glozar --- net/core/sock_map.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 19538d628714..08ab108206bf 100644 --- a/net/core/sock_map.c +++ b/net/core/sock_map.c @@ -115,7 +115,6 @@ static void sock_map_sk_acquire(struct sock *sk) __acquires(&sk->sk_lock.slock) { lock_sock(sk); - preempt_disable(); rcu_read_lock(); } @@ -123,7 +122,6 @@ static void sock_map_sk_release(struct sock *sk) __releases(&sk->sk_lock.slock) { rcu_read_unlock(); - preempt_enable(); release_sock(sk); } base-commit: 22117b3ae6e37d07225653d9ae5ae86b3a54f99c -- 2.39.3