Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1961889pxk; Tue, 1 Sep 2020 11:58:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI5AwzY2hEdOhalA5uorBMrO1B9n/yhR/VS5k4Saw1i8GDVTfRh9Ccj+0T3mRNNc0Bm/vf X-Received: by 2002:a17:906:768c:: with SMTP id o12mr2792117ejm.269.1598986712327; Tue, 01 Sep 2020 11:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598986712; cv=none; d=google.com; s=arc-20160816; b=GwlmEUiZ1q6t9ZK//voPKlGKBm8iauXTsSVty7/kl/YkaTNT4ZKoL1h8LoYZgvd4QG ZQck93kwVB+Vla/8rzZZPAYwVQDwksXzR/TYiXiyQXWyZMQ3fRsSMn9B9YLoddDRifuP GL9fA0FnrhWtuKbgIve4ZR+9JMTqtKTlZSML8cIUeJS1KPFwn+wNGngX9Ff42pTzxyKJ BXQeG0fCgGAdl1hiTa3rYGVw5HiiKTNkE8tQ3rDL/npW0yd7mKa0HmcS3LS4DxNj6XtP JcXBlFOi5ZrifcCwgbFsUVZpxvod0G3nEgjsbnKhk7R7ftiutxF2LBoo3cJ7eyT7AuGq SYzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V69TM0TXJZV6Ph3DQcWjjVMFJyyhsm9AOvCWZiY6Tfg=; b=0KIG86n8HlI9wmB2UgVn1wGp5BeJqiL4A8HJ42zI5uNFRyJPeF0DXMntIwKlMqMec+ HOsme5+sA2UgoaxS4hMUm1jjHtjeTF+IhR5VxL7jvZDbccbQYTvvuXyca2jr14jqm4v+ U7AM6MI9V9+ASVtHj1keYDXr2KgxxVfXvYbknqwOKhpcpC1tuhXSO6GdmmMYz2qFj96q 9LBMGv7Bwi1ps9qt52cWpzngEbPsIGDqEXxuvzBBAWNu9ng/skYOrbQoh9BP16Ono2g0 Ct3691o+L8NA/8xrj9NfWb8nJopAFwB4et65Zey+3pqsDs0KYDzXYmSRayQmhNRsE5rW FdoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=npTqPcLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si1181665edx.243.2020.09.01.11.58.09; Tue, 01 Sep 2020 11:58:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=npTqPcLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726490AbgIASxQ (ORCPT + 99 others); Tue, 1 Sep 2020 14:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728971AbgIASxG (ORCPT ); Tue, 1 Sep 2020 14:53:06 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D57C061249; Tue, 1 Sep 2020 11:53:06 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id b3so1722916qtg.13; Tue, 01 Sep 2020 11:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V69TM0TXJZV6Ph3DQcWjjVMFJyyhsm9AOvCWZiY6Tfg=; b=npTqPcLDLPp9IG+8hih3s0n1i8HE84G+rEqAq7/0mzOvX4YAHvQawMoRbgGBQt3Yig 2eneUEERH+HTyLTzXLB4YL2RGRONA0RTWYNtrj47yF3wKaXG1SvQcwpDJCy21eZ5Jsca sZEjiM8Q8sRrkCSCdh7obp3ZwzFnJGVNkTOhuz/R6vNzBKji4+ZPo5x3PfxZMyNd2OBO M4MTsGJ65P64qH13pbf0vQEUgLCZYCKSqoDEAtJXuzOVPMrbIWAIgJY6kryL066yazx7 Vx3KNiFq7vpMib+dcpa+l8yunUwdH0plUmX8yPgAs/DeFZ1XTCDGXi3fKIOkg1FtiVS1 14Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=V69TM0TXJZV6Ph3DQcWjjVMFJyyhsm9AOvCWZiY6Tfg=; b=cnJZo/Dt72HBDE5s+8d5RYjwUgpq3tGYuLztZuckz2LwqW3SEmNbiRgdrcQf0k9VS5 s/JvjUO8npffcxcGN6JtQsxr/ERjjj43+ga0WxU9msqKNsm1UbkpOx/9CNeIu7Nl83bZ ukDTkvYazFamr6/3xZn0glhCwAdaG2klSme9sKgKgjpn1H+0ynzB7LVHYaL4F7ooMoxX 0xVZSxqFutfo6MlkbkYMQDEtcFMq1dBleU+Kdx5LV0R+lI1/Poi2aOe9UuYbyqvJc1KC z7yMzSB8sDlyZdzx9zijgssyK8YsQWQF+SFumFRvX/n8U9e4mzwJnO39Cjttd7y9Bmgr Ge1Q== X-Gm-Message-State: AOAM532soo0nFo2HYG+vuUNTJEdIY89ZGrLmfgl5YEUC3GXOlhx9jrnw TOIk0crfFD+dYxSdoQ+nII0= X-Received: by 2002:ac8:5303:: with SMTP id t3mr3360197qtn.159.1598986385416; Tue, 01 Sep 2020 11:53:05 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:a198]) by smtp.gmail.com with ESMTPSA id x26sm2262245qtr.78.2020.09.01.11.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 11:53:04 -0700 (PDT) From: Tejun Heo To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, newella@fb.com, Tejun Heo , stable@vger.kernel.org Subject: [PATCH 01/27] blk-iocost: ioc_pd_free() shouldn't assume irq disabled Date: Tue, 1 Sep 2020 14:52:31 -0400 Message-Id: <20200901185257.645114-2-tj@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200901185257.645114-1-tj@kernel.org> References: <20200901185257.645114-1-tj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ioc_pd_free() grabs irq-safe ioc->lock without ensuring that irq is disabled when it can be called with irq disabled or enabled. This has a small chance of causing A-A deadlocks and triggers lockdep splats. Use irqsave operations instead. Signed-off-by: Tejun Heo Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org # v5.4+ --- block/blk-iocost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 413e0b5c8e6b..d37b55db2409 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2092,14 +2092,15 @@ static void ioc_pd_free(struct blkg_policy_data *pd) { struct ioc_gq *iocg = pd_to_iocg(pd); struct ioc *ioc = iocg->ioc; + unsigned long flags; if (ioc) { - spin_lock(&ioc->lock); + spin_lock_irqsave(&ioc->lock, flags); if (!list_empty(&iocg->active_list)) { propagate_active_weight(iocg, 0, 0); list_del_init(&iocg->active_list); } - spin_unlock(&ioc->lock); + spin_unlock_irqrestore(&ioc->lock, flags); hrtimer_cancel(&iocg->waitq_timer); hrtimer_cancel(&iocg->delay_timer); -- 2.26.2