Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3221823rwb; Sat, 12 Nov 2022 01:16:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf79jrxFKDQXb8ysDCH31AykfYEzqiL9yd/E5q/LAN0e3cEpvLBKq01Ce8rYmHl2wwpOHkmI X-Received: by 2002:a17:902:b611:b0:188:acb7:97f4 with SMTP id b17-20020a170902b61100b00188acb797f4mr5211625pls.19.1668244589624; Sat, 12 Nov 2022 01:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668244589; cv=none; d=google.com; s=arc-20160816; b=QDVVNvKbR4IdtcRoxUUbijQ9B21l5Iy9n2jcyj6mRCR1W1xaJd9/Gf2OvWUygIIy1N PNjcIBf4Sqg9rGA0ikXz46mmef4KOEWE8/19jwc9y60f0r1D9klVRCH71ZpXmziw9oz6 26j0i/JJc5piWnxxR2yX0ZV5FbNDebuBYYzI08pv9S/zIoMI53GU5y9EE8uYaaYS+e+8 xGxAwk0VKOGahyV/BPDn/I3voEKqFO5IGKbHUlLsR4Kcf7tcIHDnY8IT+GycsnT5LbGR 5+XtO9quDByefkQRZdCEaZ/1g1U0tXHsYGSBOVg7GwoDMRNdP4BhDAwr/uwjHMG6yxQ6 GOBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hMtIW1pF4F1HgIncq5kRA1+gRYiFGlCWwc6P8JESMgo=; b=b6DtJ+Pn0RrTuxvnzS5YHRSXxURrr4te0AigbLRBLMt+q2qp5zmTmeezYrj/93xt9Y a5zhDbDED7SSQda9oObtawh2kzG56d+8OQt9/+R32W3tckm+ItvTRChJQ+NPwa9D2W9C AVzKuTUCt5dqY04XLAphMMvLIWhBHdyRUOz2XiST8Zktdb1v29gw/KFnG+Wpl/b3bPnG qH+QR25ldGDB3Rqg3/+64MAgTTiGc1gH8YdG35xi9dOdPt5hVZoJ8J8ZH9O2VVa84w2l 4YvVxp/+PEuEx/nbSrA0G6bQYaiIAo6gdq0a9sdMRsfbVllTNLw6//4Sflfdz2t2pqOA suWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mZZxpJfI; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a17090a868400b00209a3e49f63si9348120pjn.94.2022.11.12.01.16.17; Sat, 12 Nov 2022 01:16:29 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=mZZxpJfI; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233739AbiKLI7R (ORCPT + 90 others); Sat, 12 Nov 2022 03:59:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiKLI7Q (ORCPT ); Sat, 12 Nov 2022 03:59:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A5F205F9 for ; Sat, 12 Nov 2022 00:59:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 25774B80025 for ; Sat, 12 Nov 2022 08:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08C0AC433C1; Sat, 12 Nov 2022 08:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668243551; bh=Ypk2MWBUPXJv/NWxF6HqJaH7mpCsB7DE1ZHqHg7Zn2c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mZZxpJfIVz3AC8YJOWuefWNyai5N24xOfjam+lheVm+peFLghpgxzlOwLk7rwsxh+ RJg4BMjBdZjI/jyA+xJXwrBBwXck4pA+vi48vzFhY9QDHaJmUfobGM4nmMmz2B2S3N iYY9I9NCAapjyE4vMUm1OIz700GpVKCh/xRKnlEU= Date: Sat, 12 Nov 2022 09:59:08 +0100 From: Greg Kroah-Hartman To: Liu Shixin Cc: Thomas Gleixner , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] genirq/irqdesc: hide illegible sysfs warning of kobject_del() Message-ID: References: <20221112093939.616270-1-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221112093939.616270-1-liushixin2@huawei.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Sat, Nov 12, 2022 at 05:39:39PM +0800, Liu Shixin wrote: > If irq_sysfs_add() failed, system will report a warning but don't call > kobject_put() to release the descriptor. I can not parse this sentance :( > Then in irq_sysfs_del(), we continue to call kobject_del(). In such > situation, kobject_del() will complains about a object with no parent > like this: Then we should not be calling irq_sysfs_del() if the call failed. That is the real fix here. > > kernfs: can not remove 'actions', no directory > WARNING: CPU: 0 PID: 277 at fs/kernfs/dir.c:1615 kernfs_remove_by_name_ns+0xd5/0xe0 > [...] > Call Trace: > > remove_files.isra.0+0x3f/0xb0 > sysfs_remove_group+0x68/0xe0 > sysfs_remove_groups+0x41/0x70 > __kobject_del+0x45/0xc0 > kobject_del+0x2a/0x40 > free_desc+0x44/0x70 > irq_free_descs+0x5d/0x90 > [...] > > Use kobj->state_in_sysfs to check whether kobject is added succeed. And > if not, we should not call kobject_del(). That does not describe what you are doing here at all. > > Signed-off-by: Liu Shixin > --- > kernel/irq/irqdesc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index a91f9001103c..a820d96210d4 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -300,10 +300,11 @@ static void irq_sysfs_del(struct irq_desc *desc) > /* > * If irq_sysfs_init() has not yet been invoked (early boot), then > * irq_kobj_base is NULL and the descriptor was never added. > + * And the descriptor may be added failed. > * kobject_del() complains about a object with no parent, so make > * it conditional. > */ > - if (irq_kobj_base) > + if (irq_kobj_base && desc->kobj.parent) How would the parent be NULL? Parent devices always stick around until the child is removed, otherwise something is really wrong here. You should never have to look at the parent. thanks, greg k-h