Message ID | 20230604070255.172700-1-o-takashi@sakamocchi.jp |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2023406vqr; Sun, 4 Jun 2023 00:55:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kgbzGcjJRPYLowjtN06aQwgZvPeUZIglrSXU6ARQoDKB6bN8iGWOk5lUqAgzUrA3PrkqQ X-Received: by 2002:a05:6358:9896:b0:123:5c29:c39a with SMTP id q22-20020a056358989600b001235c29c39amr16132729rwa.31.1685865337409; Sun, 04 Jun 2023 00:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685865337; cv=none; d=google.com; s=arc-20160816; b=dWV5qG9IvCtrH38ltVDfBe5iCWP7RONVGgHzWVomzRXThHW9mj3UVj4qFYXPgfprV3 WndBhBMJYZcwTiX0lFUobrYcj70iYFC5a6aM/5HbUpFAMEFm4cGOBLMJ279B+JA+ImEp rDfsy7yrDm686uBShwjXeCgnM9vUAtXRMToCI9dvas/4l9ZkDOlICsgDOEG9FH7UDuSf cNwKuAcY9p1cz2Q+3tv3S6wtgkZ7kLHGYZrvGopIA8sHeu6nxNq/KsQ2aQtRyd/WXluK fbPiAhjtx+UPD+DImRjFNo7rS1HFWnx9j/VMmrt7+7cqPjotvW8MRev1Sj02HSNMNcpw cpQQ== 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:to:from:feedback-id:dkim-signature :dkim-signature; bh=FQJ13Aq87tYV6JYGYfyduSzT1CwAmRLXUL1KgqmPHmk=; b=b7XTP6Ul+h/rNNdJsXKb4dlYQhxzt+0CCvfM/R20oSzC74jet9bwj8VVEcW88aEhHo RiLBNGiN0ZuANyp3Px2MPJfqbOT0f0l39ca0zGFbanG7pVtIpFVZP8nziLKgWhm+dbwI YkiHnRHeK6OenrnPM43Tk50BgdUf8KH6wIxCt5Yf4W+KvrTbsr8ia+XRtbZihQkhiMLU eIsRHCMftz4TtEnttBzDRLIKQC6yFbJBR/Kf7vDQaV2qBJ+FD2XRAUxEgJexqK3RJrOT M0jURHVSfJJDQ8wfWGYy3BcQcQQAZi/5Ushe05iiUyUA0bfe1pEpNSOoBBDBmOJIN8qy BzAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=W8fqjJIk; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=uR4KDaQL; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020a63ab0d000000b0053ef1799a71si3671312pgf.399.2023.06.04.00.55.25; Sun, 04 Jun 2023 00:55:37 -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=@sakamocchi.jp header.s=fm1 header.b=W8fqjJIk; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=uR4KDaQL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbjFDHDF (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Sun, 4 Jun 2023 03:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjFDHDD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 4 Jun 2023 03:03:03 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926ADB4 for <linux-kernel@vger.kernel.org>; Sun, 4 Jun 2023 00:03:02 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id DD8185C0107; Sun, 4 Jun 2023 03:02:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 04 Jun 2023 03:02:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1685862179; x=1685948579; bh=FQJ13Aq87t YV6JYGYfyduSzT1CwAmRLXUL1KgqmPHmk=; b=W8fqjJIkD11IW5l3MAr6h09/zY Cu/f06dNh7+20PCgVp/815GnvWEFY1ORUIYhRheeTGPzUopZvMnmd4KfskXsNs24 lfnBdl089tV8b1pLfSOw2LUZmrWx+4Xr+a6Piw4RVDCj+qoS3xrxrGruScI8mA+1 tf6e9l27Hvmn4JCU7G7Cjn24VmoszrHHfliACwGLguaP40Y+LnduYrwrqCVRxMzf AHpgIt1Du7vKBPOe9Y1gZEII9Pc3BoQ1tbHwNKEjhbAss4nCF7At3EcBTB10n3EM GfNiydiwpUThtjDBfjLOWGaLHBTeHKv6M3UDELM3uCxFfORWqYmiuVU3Lwgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1685862179; x=1685948579; bh=FQJ13Aq87tYV6JYGYfyduSzT1CwA mRLXUL1KgqmPHmk=; b=uR4KDaQLvqDeWzWdcZO5/gmIzAY1Y4RES76/+999XOPo rJBhqZqt54/HkLhKTjm+Y3emySsiH1qs8RZ38Lw+K0sMre4Xp/hWRUEx54Mll+q3 HIR7AaDuJ0LUFAZsaPwOa0DhoCz90fJR6znxVsF6qgaI6Uuo70U6Qpmevny2TgjE q4a+ZMxBfsDAlmvygo1/1bAqKak1mW3G8ZZRgTsGNy3EMwJchl5CFH2gVfeZF5E0 19E/PewNldCuVKGUPkTt7EZInTmDrXOyezAaLKx6lN1rY6w35aYzLznHz8DDpz/u 6mI8xhrU9EbrNm+IFc6egjeXegTiyR2uLHzHzzHbWw== X-ME-Sender: <xms:Izd8ZJRgs7x8KQP_LsS3SvKHlbqr3j7gl1Nm8KzMybd4DEJLEl0LrQ> <xme:Izd8ZCwziynRUu1sy9iHs2DrxUSd3qaPiCgIp50_BYsxEiSC_vB7PN4W1ypxxP80g JzW8UgJyIm7Z4KlWpM> X-ME-Received: <xmr:Izd8ZO2pLgx6S43cdIh6yPZsoX2wRuwQDcXgHsFHUeHxzGpvz3599eQLPPhmblfJgUb7ANiSMZ2C60IHFxJtxIY9JhgFayM4j_qYOp967WI> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeliedguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedujeetlefhtd dtkefgtdeuieelhffgteejjeehkeegveduvdevgeeiheeuueekjeenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhp X-ME-Proxy: <xmx:Izd8ZBC06I3WaM4OYBrR1P_5BUlTHs0G-NEW8I2xhdn_gE9RI8NGOA> <xmx:Izd8ZCjP3pjmKmYSrlVJW-urXSOr3LhJrsP6O6X-bxWOpZ4ONxl84g> <xmx:Izd8ZFrAwm5YTIZhJjxhaoqxmCeZTO69yf8ctUv2VbK1M28t18nwWw> <xmx:Izd8ZKI3HHhZKlcFK-AHgpHGLrlDYp1zI3AiXiJ_miCNrnfDJCd5Vg> Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 4 Jun 2023 03:02:58 -0400 (EDT) From: Takashi Sakamoto <o-takashi@sakamocchi.jp> To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] firewire: core: obsolete usage of GFP_ATOMIC at building node tree Date: Sun, 4 Jun 2023 16:02:55 +0900 Message-Id: <20230604070255.172700-1-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767757932145833864?= X-GMAIL-MSGID: =?utf-8?q?1767757932145833864?= |
Series |
firewire: core: obsolete usage of GFP_ATOMIC at building node tree
|
|
Commit Message
Takashi Sakamoto
June 4, 2023, 7:02 a.m. UTC
The flag of GFP_ATOMIC is given to the call of kmalloc when building node
tree, but the call is not atomic context. The call of
fw_core_handle_bus_reset() and fw_core_remove_card() builds the tree,
while they are done in specific workqueue or pci remove callback.
This commit obsolete the usage of GFP_ATOMIC.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
drivers/firewire/core-device.c | 2 +-
drivers/firewire/core-topology.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On Sun, Jun 04, 2023 at 04:02:55PM +0900, Takashi Sakamoto wrote: > The flag of GFP_ATOMIC is given to the call of kmalloc when building node > tree, but the call is not atomic context. The call of > fw_core_handle_bus_reset() and fw_core_remove_card() builds the tree, > while they are done in specific workqueue or pci remove callback. > > This commit obsolete the usage of GFP_ATOMIC. > > Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> > --- > drivers/firewire/core-device.c | 2 +- > drivers/firewire/core-topology.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Applied to for-next branch. Regards Takashi Sakamoto
On 2023-06-04, Takashi Sakamoto <o-takashi@sakamocchi.jp> wrote: > The flag of GFP_ATOMIC is given to the call of kmalloc when building node > tree, but the call is not atomic context. The call of > fw_core_handle_bus_reset() and fw_core_remove_card() builds the tree, > while they are done in specific workqueue or pci remove callback. The comment is incorrect about not being in atomic context. fw_core_handle_bus_reset() calls build_tree() with the card->lock spinlock held. With 6.6-rc1 I see: [ 12.555784] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306 [ 12.555808] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 70, name: kworker/1:2 [ 12.555814] preempt_count: 1, expected: 0 [ 12.555820] INFO: lockdep is turned off. [ 12.555824] irq event stamp: 208 [ 12.555828] hardirqs last enabled at (207): [<c00000000111e414>] ._raw_spin_unlock_irq+0x44/0x80 [ 12.555850] hardirqs last disabled at (208): [<c00000000110ff94>] .__schedule+0x854/0xfe0 [ 12.555859] softirqs last enabled at (188): [<c000000000f73504>] .addrconf_verify_rtnl+0x2c4/0xb70 [ 12.555872] softirqs last disabled at (182): [<c000000000f732b0>] .addrconf_verify_rtnl+0x70/0xb70 [ 12.555884] CPU: 1 PID: 70 Comm: kworker/1:2 Tainted: G S 6.6.0-rc1 #1 [ 12.555893] Hardware name: PowerMac7,2 PPC970 0x390202 PowerMac [ 12.555898] Workqueue: firewire_ohci .bus_reset_work [firewire_ohci] [ 12.555939] Call Trace: [ 12.555944] [c000000009677830] [c0000000010d83c0] .dump_stack_lvl+0x8c/0xd0 (unreliable) [ 12.555963] [c0000000096778b0] [c000000000140270] .__might_resched+0x320/0x340 [ 12.555978] [c000000009677940] [c000000000497600] .__kmem_cache_alloc_node+0x390/0x460 [ 12.555993] [c000000009677a10] [c0000000003fe620] .__kmalloc+0x70/0x310 [ 12.556007] [c000000009677ac0] [c0003d00004e2268] .fw_core_handle_bus_reset+0x2c8/0xba0 [firewire_core] [ 12.556060] [c000000009677c20] [c0003d0000491190] .bus_reset_work+0x330/0x9b0 [firewire_ohci] [ 12.556079] [c000000009677d10] [c00000000011d0d0] .process_one_work+0x280/0x6f0 [ 12.556094] [c000000009677e10] [c00000000011d8a0] .worker_thread+0x360/0x500 [ 12.556107] [c000000009677ef0] [c00000000012e3b4] .kthread+0x154/0x160 [ 12.556120] [c000000009677f90] [c00000000000bfa8] .start_kernel_thread+0x10/0x14 John Ogness
Hi, On Wed, Sep 13, 2023 at 11:54:39AM +0206, John Ogness wrote: > On 2023-06-04, Takashi Sakamoto <o-takashi@sakamocchi.jp> wrote: > > The flag of GFP_ATOMIC is given to the call of kmalloc when building node > > tree, but the call is not atomic context. The call of > > fw_core_handle_bus_reset() and fw_core_remove_card() builds the tree, > > while they are done in specific workqueue or pci remove callback. > > The comment is incorrect about not being in atomic > context. fw_core_handle_bus_reset() calls build_tree() with the > card->lock spinlock held. With 6.6-rc1 I see: Thanks for your report. Just now I sent fixes to Linus for 6.6-rc1. It is expected to apply it to stable 6.5 kernel as well. > [ 12.555784] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306 > [ 12.555808] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 70, name: kworker/1:2 > [ 12.555814] preempt_count: 1, expected: 0 > [ 12.555820] INFO: lockdep is turned off. > [ 12.555824] irq event stamp: 208 > [ 12.555828] hardirqs last enabled at (207): [<c00000000111e414>] ._raw_spin_unlock_irq+0x44/0x80 > [ 12.555850] hardirqs last disabled at (208): [<c00000000110ff94>] .__schedule+0x854/0xfe0 > [ 12.555859] softirqs last enabled at (188): [<c000000000f73504>] .addrconf_verify_rtnl+0x2c4/0xb70 > [ 12.555872] softirqs last disabled at (182): [<c000000000f732b0>] .addrconf_verify_rtnl+0x70/0xb70 > [ 12.555884] CPU: 1 PID: 70 Comm: kworker/1:2 Tainted: G S 6.6.0-rc1 #1 > [ 12.555893] Hardware name: PowerMac7,2 PPC970 0x390202 PowerMac > [ 12.555898] Workqueue: firewire_ohci .bus_reset_work [firewire_ohci] > [ 12.555939] Call Trace: > [ 12.555944] [c000000009677830] [c0000000010d83c0] .dump_stack_lvl+0x8c/0xd0 (unreliable) > [ 12.555963] [c0000000096778b0] [c000000000140270] .__might_resched+0x320/0x340 > [ 12.555978] [c000000009677940] [c000000000497600] .__kmem_cache_alloc_node+0x390/0x460 > [ 12.555993] [c000000009677a10] [c0000000003fe620] .__kmalloc+0x70/0x310 > [ 12.556007] [c000000009677ac0] [c0003d00004e2268] .fw_core_handle_bus_reset+0x2c8/0xba0 [firewire_core] > [ 12.556060] [c000000009677c20] [c0003d0000491190] .bus_reset_work+0x330/0x9b0 [firewire_ohci] > [ 12.556079] [c000000009677d10] [c00000000011d0d0] .process_one_work+0x280/0x6f0 > [ 12.556094] [c000000009677e10] [c00000000011d8a0] .worker_thread+0x360/0x500 > [ 12.556107] [c000000009677ef0] [c00000000012e3b4] .kthread+0x154/0x160 > [ 12.556120] [c000000009677f90] [c00000000000bfa8] .start_kernel_thread+0x10/0x14 > > John Ogness Thanks Takashi Sakamoto
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index aa597cda0d88..a3104e35412c 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -1211,7 +1211,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) * without actually having a link. */ create: - device = kzalloc(sizeof(*device), GFP_ATOMIC); + device = kzalloc(sizeof(*device), GFP_KERNEL); if (device == NULL) break; diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c index f40c81534381..88466b663482 100644 --- a/drivers/firewire/core-topology.c +++ b/drivers/firewire/core-topology.c @@ -101,7 +101,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color) { struct fw_node *node; - node = kzalloc(struct_size(node, ports, port_count), GFP_ATOMIC); + node = kzalloc(struct_size(node, ports, port_count), GFP_KERNEL); if (node == NULL) return NULL;