From patchwork Tue Oct 20 08:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greentime Hu X-Patchwork-Id: 11845995 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A0FE14B4 for ; Tue, 20 Oct 2020 08:15:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5E7322409 for ; Tue, 20 Oct 2020 08:15:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kYasCNOE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="d9okPnmV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5E7322409 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=jUtdqXCXGIaqFqzVT7Tvskv2w+1hyHBVekebOglkt0w=; b=kYasCNOExLgQik+h92f6PYChUW Bi7KncJxPKUa7Ap7bXVcF83OM/+voAzExhooJlraf6Tqf5Cr4Fru5W+5xCmyY2R0P1VxMkdoOP4ZM LXo6bWYpVV/EACdkhZqvYvZ1zcc3I8PiVUrQMbhbNjPHAjN4R6CqfA4Qh1ESeMfTYMIZ/leckoC5z fFHfIGPJAajLf/9sCNrRbx3OKsYggj6KLvyUx26JpUxbz2XI+6hAr+0Uv4Hfl9j3EUXfByg/qdpF0 QSnzQ9ZtNhO1YBlBYYarfX9sPEVzgstLKSiMuy5qh5FhKz7hQA3wNqXLLvEeWjfl9Bzsb/IFCaD0G rMWuto7w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUmo4-0006h7-8T; Tue, 20 Oct 2020 08:15:44 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUmo1-0006gB-Nw for linux-riscv@lists.infradead.org; Tue, 20 Oct 2020 08:15:43 +0000 Received: by mail-pg1-x542.google.com with SMTP id h6so629999pgk.4 for ; Tue, 20 Oct 2020 01:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=0YK1nIJBsgxv091uhUt5L5xJDje4QWnCuA8VHo/g6Ws=; b=d9okPnmVupD8rHYX6my6F/j3umo/o0OO9rRFa4oiHLKL/DoZPlX6Jc4H3qeLzD07W9 0viq01r9kXB3IdCeD4Fo7I5kKPOqcifApQp6iwjHTqS1JwaU4Nuigth5McHAvSyo0vOl FesOigOE0+h60fR+Rgf15cpHIQSz+G8K9VVprBnvrwiZjoBpmuydBnlEc0NWb90OGPKF lXEsXsVBaC5Ecb6e4RfFsURGwwv4d6QpJOidvz2lhCWbdrt/QJ8xUQC40MPZKFKT0gsA q8tQlZaYi+xvY53R09/WQzpfmb/dK+WREDZEynoPaC5RCIhgOopSncpwpSJvLtAn8Awb 4RMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=0YK1nIJBsgxv091uhUt5L5xJDje4QWnCuA8VHo/g6Ws=; b=JKjyzMZ1W6HbEjh0f627kmNgU9hJ9X1U2Lx63fUjEg8AN9e5I076vISGq6pEoOhEli 5Z8AasayudTG+Wjm4R1XYvkeCURsc5gf6SpVrd0lxF0B3jfKVTr31I/icBM11XOiKKY2 G/NiL3Lo83fXrKLMIDoM9sTzPMUw+7CUN0cPId67NAzyiDjyqvmGt40D3GDcWXPQHyfl +ZQJWPKhIMkhG7vgBXZofv8TEBJIAV5j7AjOKWzGFXkd0UBRyq6RaLHGp6J7SVsjjRB4 p5pcFR/N/F6Ec1Yu+xT4SYT9/hK1/OwFw+xc4WaGkfJcYRQDHuerniVbif0YYjLbjYaU sgJw== X-Gm-Message-State: AOAM531FIb4Gm9/ZR4LlsYAnpRe24QiO51EffmZS/QsvC8MnUIhAHEyT BrQj/oAdLfoHL0dDSbPGaf03dg== X-Google-Smtp-Source: ABdhPJyNnf/J1CMd098Z6cldYbES/3Y2js3zSfEtw19ryATUSICWvCM7yJWzqhIypQvgLJOUU8PwoQ== X-Received: by 2002:a63:e441:: with SMTP id i1mr1739816pgk.221.1603181737880; Tue, 20 Oct 2020 01:15:37 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id f21sm1351469pfn.173.2020.10.20.01.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 01:15:37 -0700 (PDT) From: Greentime Hu To: greentime.hu@sifive.com, tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH] irqchip/sifive-plic: Fix broken irq_set_affinity() callback Date: Tue, 20 Oct 2020 16:15:32 +0800 Message-Id: <20201020081532.2377-1-greentime.hu@sifive.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201020_041542_070066_15404D41 X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org It will always enable the interrupt after calling plic_set_affinity() however it should set to it previous setting. Staying disabled or enabled. This patch can also fix this pwm hang issue in Unleashed board. [ 919.015783] rcu: INFO: rcu_sched detected stalls on CPUs/tasks: [ 919.020922] rcu: 0-...0: (0 ticks this GP) idle=7d2/1/0x4000000000000002 softirq=1424/1424 fqs=105807 [ 919.030295] (detected by 1, t=225825 jiffies, g=1561, q=3496) [ 919.036109] Task dump for CPU 0: [ 919.039321] kworker/0:1 R running task 0 30 2 0x00000008 [ 919.046359] Workqueue: events set_brightness_delayed [ 919.051302] Call Trace: [ 919.053738] [] __schedule+0x194/0x4de [ 982.035783] rcu: INFO: rcu_sched detected stalls on CPUs/tasks: [ 982.040923] rcu: 0-...0: (0 ticks this GP) idle=7d2/1/0x4000000000000002 softirq=1424/1424 fqs=113325 [ 982.050294] (detected by 1, t=241580 jiffies, g=1561, q=3509) [ 982.056108] Task dump for CPU 0: [ 982.059321] kworker/0:1 R running task 0 30 2 0x00000008 [ 982.066359] Workqueue: events set_brightness_delayed [ 982.071302] Call Trace: [ 982.073739] [] __schedule+0x194/0x4de [..] Fixes: bb0fed1c60cc ("irqchip/sifive-plic: Switch to fasteoi flow") Signed-off-by: Greentime Hu Reviewed-by: Anup Patel --- drivers/irqchip/irq-sifive-plic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index eaa3e9fe54e9..4048657ece0a 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -151,7 +151,7 @@ static int plic_set_affinity(struct irq_data *d, return -EINVAL; plic_irq_toggle(&priv->lmask, d, 0); - plic_irq_toggle(cpumask_of(cpu), d, 1); + plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d)); irq_data_update_effective_affinity(d, cpumask_of(cpu));