Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3666774ybb; Tue, 31 Mar 2020 09:35:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsypesk9/5SkMfSDu+lLRMWdABQ14zj9OFcBS27ya7DjL4L71Cil9Doo2H+IHC/JpcFv9LD X-Received: by 2002:aca:5e0b:: with SMTP id s11mr2525733oib.111.1585672555316; Tue, 31 Mar 2020 09:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585672555; cv=none; d=google.com; s=arc-20160816; b=sKLBu6Pb5QzTiO2Nhgk/IQIYnUtCQZUbdt6g6Wmuma6XsomMwu+Ii+ETAMBu8w/3EJ jKnVxa9jfa25h07YXxCE3WtQVvRdRXisy+oL1Gz1jI0vUpV+od6jiForAm4ykivYrfr4 Q3vCSaa29ktB1khVkhBwQHujFRRcV8IND81oLQRlDolgIJ+OS/BsPBVp908ub58yFh0d Sgx8RGDELp7fzvTotdfCmUR88bHkJQcUQkNNwalqnAmZkm0b18JpPgWHgldZOPqQYbL0 hDabwv14A4yLFqwgsyVOQzgdxUsZ5krbGaFzrcOBY+L61ba546RKJd+Bb9re26jZ7kXR YLwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id; bh=z6hMPzaMl7hU7BC1NzChl8eomdTvh1SEWHm/o7QeUG0=; b=lp2CYpSoqksAmspE8P5t/bfRaq1sp0OvMi5Wv+4qYgrxLrgxDqCUq6nIDNXLs1Fg/v JNIVnYf1M1XcdXpTnxysHMDnNcY1iJoXuUSml6hYpbcFB5SeAb/b2FKyot20waa+KMVG nyMmJ31kSMLtEarjHA5e1rLAir+fcqWptQudd1VA+py7eY566/73yp/YUrpm4GvUC2dI QFhRpR9fx0yCxg7c36RRY/tRlkHMwSIL7cik4a8kmrIuiOIlmBC/dzjbMRAwYdSDgSWh PO/LRqnti4D7Bmqq1eNxnuhufLcgBRTjkpebUVmM4CVA7nmwADOoBsDAnUY4qg96RkFs BWbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si4793193ote.129.2020.03.31.09.35.40; Tue, 31 Mar 2020 09:35:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730011AbgCaQfQ (ORCPT + 99 others); Tue, 31 Mar 2020 12:35:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:41750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730720AbgCaQfP (ORCPT ); Tue, 31 Mar 2020 12:35:15 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 E705520784; Tue, 31 Mar 2020 16:35:14 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.93) (envelope-from ) id 1jJJr7-002Vfg-QZ; Tue, 31 Mar 2020 12:35:13 -0400 Message-Id: <20200331163513.674653275@goodmis.org> User-Agent: quilt/0.65 Date: Tue, 31 Mar 2020 12:34:55 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , Julia Cartwright , Daniel Wagner , Tom Zanussi , "Srivatsa S. Bhat" , Pavel Machek Subject: [PATCH RT 2/3] irq_work: Fix checking of IRQ_WORK_LAZY flag set on non PREEMPT_RT References: <20200331163453.805082089@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19.106-rt46-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: "Steven Rostedt (VMware)" When CONFIG_PREEMPT_RT_FULL is not set, some of the checks for using lazy_list are not properly made as the IRQ_WORK_LAZY is not checked. There's two locations that need this update, so a use_lazy_list() helper function is added and used in both locations. Link: https://lore.kernel.org/r/20200321230028.GA22058@duo.ucw.cz Reported-by: Pavel Machek Signed-off-by: Steven Rostedt (VMware) --- kernel/irq_work.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/irq_work.c b/kernel/irq_work.c index 2940622da5b3..b6d9d35941ac 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c @@ -70,6 +70,12 @@ static void __irq_work_queue_local(struct irq_work *work, struct llist_head *lis arch_irq_work_raise(); } +static inline bool use_lazy_list(struct irq_work *work) +{ + return (IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !(work->flags & IRQ_WORK_HARD_IRQ)) + || (work->flags & IRQ_WORK_LAZY); +} + /* Enqueue the irq work @work on the current CPU */ bool irq_work_queue(struct irq_work *work) { @@ -81,11 +87,10 @@ bool irq_work_queue(struct irq_work *work) /* Queue the entry and raise the IPI if needed. */ preempt_disable(); - if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !(work->flags & IRQ_WORK_HARD_IRQ)) + if (use_lazy_list(work)) list = this_cpu_ptr(&lazy_list); else list = this_cpu_ptr(&raised_list); - __irq_work_queue_local(work, list); preempt_enable(); @@ -106,7 +111,6 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) #else /* CONFIG_SMP: */ struct llist_head *list; - bool lazy_work, realtime = IS_ENABLED(CONFIG_PREEMPT_RT_FULL); /* All work should have been flushed before going offline */ WARN_ON_ONCE(cpu_is_offline(cpu)); @@ -116,10 +120,7 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) return false; preempt_disable(); - - lazy_work = work->flags & IRQ_WORK_LAZY; - - if (lazy_work || (realtime && !(work->flags & IRQ_WORK_HARD_IRQ))) + if (use_lazy_list(work)) list = &per_cpu(lazy_list, cpu); else list = &per_cpu(raised_list, cpu); -- 2.25.1