Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1164189lqb; Thu, 18 Apr 2024 01:52:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrEqNNsfs1qUkWfD1ZQcVy8NuvEFhEXiqbZ2/PJhb+FBp2Gqr+5EjK77RKbboSw1TCGA8qj5YlPwR0OK+h/skHwAh7GgK5M4skWdd3Xg== X-Google-Smtp-Source: AGHT+IGNxwuzoolTvzIJwU8R/6rnX9ZnDzY0fcxf6xyoC7nXcZ/WdGUClVcORTMxfn2rgy4oriT0 X-Received: by 2002:a05:6214:564a:b0:690:c568:8dc9 with SMTP id mh10-20020a056214564a00b00690c5688dc9mr1974562qvb.36.1713430363552; Thu, 18 Apr 2024 01:52:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713430363; cv=pass; d=google.com; s=arc-20160816; b=owCn7EG65LfctFr4PDxj9txT8eGISYNNAnbJayHz6y2BCMD6zx6Eg7BaRr12OhFUOU /CjGVEUg6IL3ihxJ3S/rXq62ZrDGJRUz5kGKWtCKy/CQ07wqa8XUzSb35Z5GIfKp/Rwb eQfom9DKROBLXJB2N4y+r148m/iyzlgMkNwt/OH32dNle7Jt83xHjIGvzX4EgNY8MvDP efZVOxyEcYfJ7cOsvKqM8iFikeLxqSFvn3kAU8P91ITcov5Xngjk5Qwu/QBuRdwKLXke ALS1DT59UzE1u/7bmx5xh/Q4ekFbQf7pltANVeJDKsTCLymYTLAmeRWH9VmSX1m8fM+q 8Sow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=iJECtVaq2qdkpBCb61lA4igpSnq+uw07WFLVzceu1HI=; fh=3WIgLQraTRR/7glWpoUzJ3J8/DSujuR2av2VRPZDzKk=; b=PjTwM9dr7whsEO+It182alFmal7M1eay6VcCxFGNDswJcg51yUBlIU2dS59nEAKD0k GQFaz5ZozQqu3in8m0xmYf9JXODZbMeccCkS1Fhey6pC6TJWQ45IdfAuh37qRHRJjy92 LMZrneH47UbSciQdSsU+gXwjoGK3RJM/pTiBov9HaDOVINawXd5L1LuNDU8mevaUxigm 0V7Yxw8JVBrrLvgai/p7WFRb2EcmRcwRHUX60Ghk+3iuikvNEKnUb+6pjotEfV5iCJDp L1CasCbuq8+xZLZE/gszDS9EU28kULAaVN5/CYsJQL3KgYaOC2waBeaHuWIH7CuSmAsK 3E2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-149749-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149749-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gm7-20020a056214268700b0069b3cba3318si1047499qvb.48.2024.04.18.01.52.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 01:52:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149749-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-149749-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149749-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 492A81C20D6E for ; Thu, 18 Apr 2024 08:52:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A21015991E; Thu, 18 Apr 2024 08:52:33 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FDB42E403; Thu, 18 Apr 2024 08:52:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430352; cv=none; b=EQXAVFi36fX0OKKV1liKFvEUehO17aG/Uj7tcPeND2ImLAJVg+Y1QXXcIIvTBoS19dUJcySe9hLHGkIYWxLlmnjYOoKIfeJJBVs/H1yzUasn+2Cy89lpoonGgyVIz1TohLHEowEi5fu//MjPj6gpFHi8atphpF+b4B3uxpB2V8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430352; c=relaxed/simple; bh=/9FaQAMTMG4Df8jyveTTcRCul4tuZb79MWaz9DUKm8g=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=h4zD6ihhOp6jStYyK+D/OUOTFNlR4qDlQRQX45AMp33t9LY4hFsgxvYXoKmF7Ut7QGXz2NILFyn5GOniXfYcj91OJrbYTXe4wMdDPAzKx5d8xck1tlCnyq75zKS4KFoAjQHsnnmNOTbQHAzW5nGH8iJzZZAwhcrYmkAtjcsTz6Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VKs3P2grlz4f3p0g; Thu, 18 Apr 2024 16:52:17 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 527981A0568; Thu, 18 Apr 2024 16:52:26 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgAn9g5I3yBmNfwuKQ--.33271S3; Thu, 18 Apr 2024 16:52:26 +0800 (CST) Subject: Re: [PATCH] blk-iocost: do not WARNING if iocg has already offlined To: linan666@huaweicloud.com, tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk Cc: hch@lst.de, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20240418072340.2090877-1-linan666@huaweicloud.com> From: Yu Kuai Message-ID: <75a8212a-a6ff-416c-7bce-0f4036a4abc0@huaweicloud.com> Date: Thu, 18 Apr 2024 16:52:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240418072340.2090877-1-linan666@huaweicloud.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAn9g5I3yBmNfwuKQ--.33271S3 X-Coremail-Antispam: 1UD129KBjvJXoW7tF17Gw13KFW7Wr4Uury5CFg_yoW8Zw1DpF 45KwnrCF1jqr12kan2q3Z2q348uan5Xws3Jws3Wr15ZFyfur1Iq3Wkur4YqFy0vrn5AFsx ZF4xK3yxJa1UuaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvIb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG 6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV Cjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7Mxk0xIA0c2IE e2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxV Aqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q 6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6x kF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf 9x07UWE__UUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ ?? 2024/04/18 15:23, linan666@huaweicloud.com ะด??: > From: Li Nan > > In iocg_pay_debt(), warn is triggered if 'active_list' is empty, which > is intended to confirm iocg is avitve when it has debt. However, warn > can be triggered during removing cgroup controller, as > iocg_waitq_timer_fn() is awakened at that time. > > WARNING: CPU: 0 PID: 2344971 at block/blk-iocost.c:1402 iocg_pay_debt+0x14c/0x190 This line doesn't match the code from mainline, please mention that which kernel release you're testing. Other than that, ioc_pd_free() indeed clear 'active_list' before canceling the timer, this patch looks good to me. Reviewed-by: Yu Kuai > Call trace: > iocg_pay_debt+0x14c/0x190 > iocg_kick_waitq+0x438/0x4c0 > iocg_waitq_timer_fn+0xd8/0x130 > __run_hrtimer+0x144/0x45c > __hrtimer_run_queues+0x16c/0x244 > hrtimer_interrupt+0x2cc/0x7b0 > > The warn in this situation is meaningless. Since this iocg is being > removed, the state of the 'active_list' is irrelevant, and 'waitq_timer' > is canceled after removing 'active_list' in ioc_pd_free(), which ensure > iocg is freed after iocg_waitq_timer_fn() returns. > > Therefore, add the check if iocg has already offlined to avoid warn > when removing cgroup controller. > > Signed-off-by: Li Nan > --- > block/blk-iocost.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/blk-iocost.c b/block/blk-iocost.c > index baa20c85799d..2e109c016a39 100644 > --- a/block/blk-iocost.c > +++ b/block/blk-iocost.c > @@ -1440,7 +1440,7 @@ static void iocg_pay_debt(struct ioc_gq *iocg, u64 abs_vpay, > lockdep_assert_held(&iocg->waitq.lock); > > /* make sure that nobody messed with @iocg */ > - WARN_ON_ONCE(list_empty(&iocg->active_list)); > + WARN_ON_ONCE(list_empty(&iocg->active_list) && iocg->pd.online); > WARN_ON_ONCE(iocg->inuse > 1); > > iocg->abs_vdebt -= min(abs_vpay, iocg->abs_vdebt); >