Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2625648pxa; Mon, 17 Aug 2020 14:46:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1W3QXedf/27wWuwr44v6l/FCLSb8zpGJ1ozZBDRNvQNv5G+oV3tcYc1SyA1zl1B9cCI1+ X-Received: by 2002:a17:906:fa15:: with SMTP id lo21mr17639051ejb.42.1597700766324; Mon, 17 Aug 2020 14:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597700766; cv=none; d=google.com; s=arc-20160816; b=IpZrACnb8RCPx1m7TIQt7+eEAj2EQQxhz1tYtCskKyMUSqY+trCBPdg+0PGkIdNfIk PgwGf5uM29oNvMQsZc71JfzLq00gU7I4hM3Zi2L5C8tTKNtRxBa/eh4iTn5PCki4ia9E XMkJj7RrPzgjEFqbrM642rQZXOqWsRofEfk1QJoJX2YNbSIao1xuNq3JwSdAVZS3QaxS 7pRPXriowGKSxlbLvKAYdSBWESDYSko4q+kQu1XC1ep4FgKYqtwGaiTpmHvoz6Qm89Xq 4bNxFBWbjzs2/lpxBmAodXPP7qhDkesCMJvo4rfEJ2nqgDao/t/qDoxh9+FXH0MmXE81 B5uA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OGLRisn3hh2aQLXkgXfEogjox0HkpcttaN9V0FF6OFk=; b=iTmRWXRq90TFIq+xiQMzAy2GsYDGH1Fm21SxkfyLLzSv4JJ0kxFYWx6AHpqwFaZOJH OjQfI3HaKMSjk+IHM//uUJgo15d0KDT3QPomocWOSxhwQi6jtxUXsrLe5eAOMgi+UFyt C16+WFk4ZIFqI8p7r87SJUci66ELnkI0CNTGMj/zmXVLxoEMhc8lPKZvf54vuv53dIEU YDhI0exvaL9fjRRBoS09bXrz0WypRUJE+voRGSMd/hyl7TnW7nAlb0IhF514p/SomdUN Jl0/kCSbfN6wIIk487n0BgJgi8wsnI9BXkPLZl1/skLpQkjuT22wfiDRBDs3jyN0PgN4 0EbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q3tYdX5W; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si11866496ejo.392.2020.08.17.14.45.42; Mon, 17 Aug 2020 14:46:06 -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=pass header.i=@kernel.org header.s=default header.b=Q3tYdX5W; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729622AbgHQPYI (ORCPT + 99 others); Mon, 17 Aug 2020 11:24:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:49578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729518AbgHQPXJ (ORCPT ); Mon, 17 Aug 2020 11:23:09 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E37922D3E; Mon, 17 Aug 2020 15:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677788; bh=7wBE4qxQd8JzuuczTOr2/54TrG7cCXcr/aXR5tTrfzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3tYdX5WZxZBRGwzP2I/9D3BNQDQG1dSX0JsFckdHtg86mdfvkBZ4BdaG9Wou+SS2 kF1trSCn5K4PKZOsjwTE1gmymRlV7/SlInuqPg+mIjuRs3IMMyX/B5ihECpnAplXDj 3ZMJtbxkfjskCGXbZ0xrrZe0K4Q6lcnAZHU9+rbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bartosz Golaszewski , Marc Zyngier , Sasha Levin Subject: [PATCH 5.8 108/464] irqchip/irq-mtk-sysirq: Replace spinlock with raw_spinlock Date: Mon, 17 Aug 2020 17:11:01 +0200 Message-Id: <20200817143838.972680688@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski [ Upstream commit 6eeb997ab5075e770a002c51351fa4ec2c6b5c39 ] This driver may take a regular spinlock when a raw spinlock (irq_desc->lock) is already taken which results in the following lockdep splat: ============================= [ BUG: Invalid wait context ] 5.7.0-rc7 #1 Not tainted ----------------------------- swapper/0/0 is trying to lock: ffffff800303b798 (&chip_data->lock){....}-{3:3}, at: mtk_sysirq_set_type+0x48/0xc0 other info that might help us debug this: context-{5:5} 2 locks held by swapper/0/0: #0: ffffff800302ee68 (&desc->request_mutex){....}-{4:4}, at: __setup_irq+0xc4/0x8a0 #1: ffffff800302ecf0 (&irq_desc_lock_class){....}-{2:2}, at: __setup_irq+0xe4/0x8a0 stack backtrace: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.7.0-rc7 #1 Hardware name: Pumpkin MT8516 (DT) Call trace: dump_backtrace+0x0/0x180 show_stack+0x14/0x20 dump_stack+0xd0/0x118 __lock_acquire+0x8c8/0x2270 lock_acquire+0xf8/0x470 _raw_spin_lock_irqsave+0x50/0x78 mtk_sysirq_set_type+0x48/0xc0 __irq_set_trigger+0x58/0x170 __setup_irq+0x420/0x8a0 request_threaded_irq+0xd8/0x190 timer_of_init+0x1e8/0x2c4 mtk_gpt_init+0x5c/0x1dc timer_probe+0x74/0xf4 time_init+0x14/0x44 start_kernel+0x394/0x4f0 Replace the spinlock_t with raw_spinlock_t to avoid this warning. Signed-off-by: Bartosz Golaszewski Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20200615074445.3579-1-brgl@bgdev.pl Signed-off-by: Sasha Levin --- drivers/irqchip/irq-mtk-sysirq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c index 73eae5966a403..6ff98b87e5c04 100644 --- a/drivers/irqchip/irq-mtk-sysirq.c +++ b/drivers/irqchip/irq-mtk-sysirq.c @@ -15,7 +15,7 @@ #include struct mtk_sysirq_chip_data { - spinlock_t lock; + raw_spinlock_t lock; u32 nr_intpol_bases; void __iomem **intpol_bases; u32 *intpol_words; @@ -37,7 +37,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) reg_index = chip_data->which_word[hwirq]; offset = hwirq & 0x1f; - spin_lock_irqsave(&chip_data->lock, flags); + raw_spin_lock_irqsave(&chip_data->lock, flags); value = readl_relaxed(base + reg_index * 4); if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_EDGE_FALLING) { if (type == IRQ_TYPE_LEVEL_LOW) @@ -53,7 +53,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) data = data->parent_data; ret = data->chip->irq_set_type(data, type); - spin_unlock_irqrestore(&chip_data->lock, flags); + raw_spin_unlock_irqrestore(&chip_data->lock, flags); return ret; } @@ -212,7 +212,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, ret = -ENOMEM; goto out_free_which_word; } - spin_lock_init(&chip_data->lock); + raw_spin_lock_init(&chip_data->lock); return 0; -- 2.25.1