Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7920351rdb; Thu, 4 Jan 2024 11:53:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgQgOMsocxUY7ce+OjxDswUWVOXyHLEOG0aiO/kIgy3xfcg15zvyRrN+Kq/skYghgmL8Kj X-Received: by 2002:a17:906:2801:b0:a27:be67:1743 with SMTP id r1-20020a170906280100b00a27be671743mr587645ejc.40.1704397985733; Thu, 04 Jan 2024 11:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704397985; cv=none; d=google.com; s=arc-20160816; b=zrOcf6k1s6fX4Mmu9+P+5uKUlK7SRbf3MQ/neyNWyVnQNlqT1e8iGyvsie6/CndqV9 eJgEf3+LhFIGWZsJca6qnfE/CaoU5sgkDETo7dJaWKi6i1HJwBOttR23uYsuT3Coj74R KchmfNzt2nrUG146XxDMqZWdJWym31MR1+GgEgiMbDWWcYVsaHGDrvhuPIIa4VaO48N4 Nju9LJvRyd3cG/d1ty1/oQT+IGYmWS7WBjKE1WBYve2Ks+xFJpyH8jbiBETH9BChkeUd jWdLEr3YxuxO6ClPuU2nUSZeAaWyiE3ByIBNIyxj4jQC9PX1wQgWBOocgCBqpNe+eDxs 75aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=27dEHxVblqRTmzTZNOjf3Gz5VvfI9uGlpElf6m2975Y=; fh=+gVPwLIr5kZy9gDJdoCBEe231u+B+i4A0EIsYziepC4=; b=ekcDHLHgGRS0tjcGV00NOOtgQ5ua0pKy0MbUPAD6+MhTAKWJJKpQXXRs6vQQ0kZgnp 1C5txf/5VkirSBoxkWqIp0IwSyAVbEtd9xCqmWuR65Sm15AhYDH24HbXogL1kMqyUEsi U7t7FavFY6mPD/0JIK4qHpclewAVl/eIwgRUvBiRpjDkNUDK2HHsd1qbxhLoqvK7OjyU E5vBz6EyV5KOr9Ypu93DX6BMLNI5viMuvBU7XezYIT+oyA5kZ23sE6/BrSbgLCTzifcS Gvb8rjMIfZjoUXhTGRgtJyLz04yDsNuNBZ2UW1Byen28rAZnKia9C+kQbLSUKpuQ5FXh 5Sgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=VG1fTf00; spf=pass (google.com: domain of linux-kernel+bounces-17184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17184-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t21-20020a170906609500b00a26b291147csi10950ejj.329.2024.01.04.11.53.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 11:53:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17184-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=@wanadoo.fr header.s=t20230301 header.b=VG1fTf00; spf=pass (google.com: domain of linux-kernel+bounces-17184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17184-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr 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 795081F22F74 for ; Thu, 4 Jan 2024 19:53:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 291B52C68A; Thu, 4 Jan 2024 19:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="VG1fTf00" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51B6F2C1AD for ; Thu, 4 Jan 2024 19:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id LTlmr0sApT1UwLTlnrLohA; Thu, 04 Jan 2024 20:52:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1704397969; bh=27dEHxVblqRTmzTZNOjf3Gz5VvfI9uGlpElf6m2975Y=; h=From:To:Cc:Subject:Date; b=VG1fTf00F44jamkjYhcZD4fxQltM1JJRDg1foif2iDelfGbansTjbmPbE5KRFG7pB ZsX3svidGOVGFB2dwRhBMkJ6APdV1YJYkbUmAZvywmdRuvGT4WXpi/ZfudQz0PImwI FYVC6k+skJWAQLwG5VsMwPc3R8Tg2PH+M933Nb+rf/eNdc79IB1UaDES4Po7STOhD9 iLJeaPvbd8URy695x5dve5mGGutCn6WDhjS96+MnaKjMqyyIOfmDoaVFFu13qRK3PT 7JXfgd+7/HwqjXeQ0HVgqLg6VJIgVVLDFDYmuXG5e/beDjPtJzAtrBPh+yIAvCd/Fs DEd0+k/kIyR5Q== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 04 Jan 2024 20:52:49 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Bjorn Helgaas , Logan Gunthorpe , Eric Dumazet Cc: alexis.lothore@bootlin.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-pci@vger.kernel.org Subject: [PATCH] PCI/P2PDMA: Fix a sleeping issue in a RCU read section Date: Thu, 4 Jan 2024 20:52:35 +0100 Message-Id: <02d9ec4a10235def0e764ff1f5be881ba12e16e8.1704397858.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It is not allowed to sleep within a RCU read section, so use GFP_ATOMIC instead of GFP_KERNEL here. Fixes: ae21f835a5bd ("PCI/P2PDMA: Finish RCU conversion of pdev->p2pdma") Signed-off-by: Christophe JAILLET --- This patch is speculative. It is based on a discussion related to another patch. See [1]. It also matches the doc, IIUC. See [2] [1]: https://lore.kernel.org/all/20240104143925.194295-3-alexis.lothore@bootlin.com/ [2]: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/RCU/whatisRCU.rst#n161 --- drivers/pci/p2pdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 0c361561b855..4f47a13cb500 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -661,7 +661,7 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client, p2pdma = rcu_dereference(provider->p2pdma); if (p2pdma) xa_store(&p2pdma->map_types, map_types_idx(client), - xa_mk_value(map_type), GFP_KERNEL); + xa_mk_value(map_type), GFP_ATOMIC); rcu_read_unlock(); return map_type; } -- 2.34.1