Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4584343imw; Tue, 19 Jul 2022 09:16:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txsOC1aFkb6CleBvkX0LvoBvKpabxkZ1O+5naDaA+eqpEhuttaAxWLGkPS3LtsvIRKLGTD X-Received: by 2002:a05:622a:1803:b0:31e:f27f:f4b3 with SMTP id t3-20020a05622a180300b0031ef27ff4b3mr6931233qtc.236.1658247384695; Tue, 19 Jul 2022 09:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658247384; cv=none; d=google.com; s=arc-20160816; b=PRcSXZMkS0r02lX6g6zdh/BFoQp/KWt1iKCC0xZaZtYBvttw4vG6l/TgVWLMlTKuq3 n2j4GQa+Romh+GoOcikMexHHB7A/8hHbSCxLpYtQFoiDNrMG+wVqbbJoMh85Qe78ZsrV HAhMKurTVdaLO2rjx/CYYlFw3XqR+zUllUFOQvnHfygb9RfqFDAQ7JH1tn6gbpWpqj/j T4atwGA0xGL8RToF/4gh/X0GmXLX/eXRvbhLUAbCQVomAtd7CL5itO4/fPbrQfGOPknG VcBLLUnzENIB4GiincRfK3MtyKV8VmN0sh7l2n5syEOneqwEDgD1jptTirFDtkqb/OrN xQ/w== 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:sender:dkim-signature; bh=1KmDVlh31ZPGT/1gu3CgqryQOvMMNoshEj5LmQLClLE=; b=XDehdOUh3yGgBn7T2MjcPfQoECdOMLp2njvVnha3Prta48pfhF9WnDfViN8W5yAWZG SV04QHYyCQaHBmb7TTSbQ5MdOpuv6a7JNZP5q14JpSOobIDi+lMC9JrEd1P3FyvxGQM1 /gE3LDY790oHNcsejJyTC7ZKLL2g4eN64SCKg6c703qQ5qIBlqkFzVqCSEe9nqYYYBtP ApYelawGvW6oDuM2eivuQ2iVI1CwzW4zqZdmj6MsRS3jpjlu2TFUkIyjVBO6ACiM48/S c0Bls8YcgYSuzpzMZ85YHZCrw//cgkE9t9aMfUGkZZVIe/t0rJZnwP7oxumtcmCSc0Pw nmJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="CF2Yl7/Y"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a05620a444f00b006b57a17860esi8823293qkp.316.2022.07.19.09.16.09; Tue, 19 Jul 2022 09:16:24 -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=@gmail.com header.s=20210112 header.b="CF2Yl7/Y"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237375AbiGSPuo (ORCPT + 99 others); Tue, 19 Jul 2022 11:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239462AbiGSPu0 (ORCPT ); Tue, 19 Jul 2022 11:50:26 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363915019D; Tue, 19 Jul 2022 08:50:20 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id f65so13828617pgc.12; Tue, 19 Jul 2022 08:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1KmDVlh31ZPGT/1gu3CgqryQOvMMNoshEj5LmQLClLE=; b=CF2Yl7/YP6QIiN+4C38UCBemOvDUzg7jlB4d1bqOkoD5yqqrJB+CRjWnNPHNlMgnu+ sEHUhgCfdAlKwXHI/PmOSb1YvCYyiwG1O6dWPjunb+ExP0lN64xjqmEH93/2nrrD5XZ6 N+pHWdcCKLfvI1mDWoLpIASJOORCjdgYfVpZzvo7/4exGllQykD5IexOfM+o02tkzLE/ OIbRgvakahk0q70n3fYO/zz2Vsjd2Q23JtRKHT4gS24Xmo874q9vUSkafxEMuQ5UgR+1 arPPp2PTOhN9BEo3i3LBk+xEy81ckUNH3Ck74QxAUAykiY5kjrK2ZIud4cL7Q9iNvME6 yyYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=1KmDVlh31ZPGT/1gu3CgqryQOvMMNoshEj5LmQLClLE=; b=NS79c8Mulz/wjSutiumZQBfIIU+wXTm64ycGO7yKrEhnAJTmCPs8yMX1q11hddqrQa KP0JinqGIPzSwodQlkvbYFCv5+v031d0hjehYVTP6dwQmdlE6plZtuvs4zWscbHJzrmf pA8C7dValig3ch7CORQMGFlLgRqGyKZvZPuGyZCltpsr2MxGWIRm8drtig1FezHEkl7t Kv/LMWHZHMRoIGvjY33tSYo4xGeW1kr8tbTneQsi0SPZlumq6qgF33L8Wzxfq7HRK9J+ esZUYzq6lZ0XBRhNvVyNrRUPJlRaR1OKbn1tTBDg0bJhBTQ/EdBQlZ36Iy/v0ZaYqSY8 SL1Q== X-Gm-Message-State: AJIora+XFR6W/+ACrFCyBI4A/FVjjzzTigRBA3uCtxiIuXkR2cI+Kjn+ HnhGwwlKF9spQK0pyURsA7ix4aRRdpo= X-Received: by 2002:a63:f90d:0:b0:419:b112:91ea with SMTP id h13-20020a63f90d000000b00419b11291eamr25506678pgi.592.1658245819292; Tue, 19 Jul 2022 08:50:19 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:c106]) by smtp.gmail.com with ESMTPSA id e13-20020a170902ef4d00b0016d1ab31b05sm348255plx.42.2022.07.19.08.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 08:50:18 -0700 (PDT) Sender: Tejun Heo Date: Tue, 19 Jul 2022 05:50:16 -1000 From: Tejun Heo To: Jinke Han Cc: axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2] block: don't allow the same type rq_qos add more than once Message-ID: References: <20220719070258.25721-1-hanjinke.666@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220719070258.25721-1-hanjinke.666@bytedance.com> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 Tue, Jul 19, 2022 at 03:02:58PM +0800, Jinke Han wrote: > From: Jinke Han > > In our test of iocost, we encounttered some list add/del corrutions of > inner_walk list in ioc_timer_fn. > > The reason can be descripted as follow: > cpu 0 cpu 1 > ioc_qos_write ioc_qos_write > > ioc = q_to_ioc(bdev_get_queue(bdev)); > if (!ioc) { > ioc = kzalloc(); ioc = q_to_ioc(bdev_get_queue(bdev)); > if (!ioc) { > ioc = kzalloc(); > ... > rq_qos_add(q, rqos); > } > ... > rq_qos_add(q, rqos); > ... > } > > When the io.cost.qos file is written by two cpu concurrently, rq_qos may > be added to one disk twice. In that case, there will be two iocs enabled > and running on one disk. They own different iocgs on their active list. > In the ioc_timer_fn function, because of the iocgs from two ioc have the > same root iocg, the root iocg's walk_list may be overwritten by each > other and this lead to list add/del corrutions in building or destorying > the inner_walk list. > > And so far, the blk-rq-qos framework works in case that one instance for > one type rq_qos per queue by default. This patch make this explicit and > also fix the crash above. > > Signed-off-by: Jinke Han Acked-by: Tejun Heo Thanks. -- tejun