Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1786228pxb; Fri, 24 Sep 2021 11:48:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtrGZWR6n4y1g8pCOL2FIDGkYQU5hse7/4brooSGzI4LYUeTWmL2nCJ+wHcv1y6UDSS0La X-Received: by 2002:a05:6e02:216e:: with SMTP id s14mr9793410ilv.154.1632509339663; Fri, 24 Sep 2021 11:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632509339; cv=none; d=google.com; s=arc-20160816; b=WHkyhQsfHCHioh6nyXC4kQPFin+BGBAIztYYB1wdEnQQoEM00ODxliDLrCRVNnTO0X 0ghONReQiTlweG0uT5JAVN9FgQQMVpwst0B32a8h3JMdGRm7Y8/Ia71/SpfC7oag1w2D 8B9rcxjgk3QFd1R0CaBiBBG/RqCQuuJi/qh4yO/43I6Zveyqma7iPanDD3puM2GqYwsQ PVeYUFZtdlPg49eMWM8CRnIQaoEXHZufP3U3cCK1MwNLm5c+/l3E8lkeqQshaT/G4TDN 4gyuKggOdU7uUo1As8ZaGeahZmXbTM3XtI+YjKRYcBHPvvIIVaIf41Ikz4NW0F1PenC5 Og8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ey/A9B0MSwG7zsa/gaHXxY+0g3387WdwEYZ+0g8QT60=; b=dlUb6h6zDI/PziBfLL2n50aO4Voz4tJiVC7JVYy7uwrqZX5uTJjq2yrn9tHMJEYzpG VeUXS6VGd/i3CtLtXHzyl2khzPDkLmJsLBPYpIyrBa0wjcG/VOgcKfc4ZNhGd/iHX2rD AfchA7f7huyRQwvndbcZGVM2fLcYvKjJc1B3ikCUF2TA43Kvdt01BCXNj7caUFV1vdIx GKvKYsdqxPuZTjfDApnFxyW3t66JDki9zOJd/DrzouHRkuz+6e154oNs/u6wFkakwU8F ckFKBKu4j9pjE5A5bNfa6CGntP2F6KODqiN8OLxkCxmdrLtzfcde7ACq/mRrJsQ49Ry1 ovYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PPsxoGot; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l126si10166456ioa.77.2021.09.24.11.48.46; Fri, 24 Sep 2021 11:48:59 -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=@linuxfoundation.org header.s=korg header.b=PPsxoGot; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345877AbhIXNOd (ORCPT + 99 others); Fri, 24 Sep 2021 09:14:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:38146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346428AbhIXNLC (ORCPT ); Fri, 24 Sep 2021 09:11:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01B64613AC; Fri, 24 Sep 2021 12:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632488306; bh=GQf2J0qqmeF/2WB/2+mspJAQ//rcwTHy1ozVhKJBdC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPsxoGotVkn5C87l3345jyZ9wqoZrOyKk2r+U+LVT8sK/d+dYIrcpBqkzve+attRM v24x8R2FrmbbxCJr7U3DWJ923aFGTXaYp+k/Tl0fGCP+L3x0l1n5h5hBxEpKQmG+yq rE/jiZpMf4/XaMDY8pAP67fCCksH5FJ/EW8+pvtg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Sebastian Andrzej Siewior , Sasha Levin Subject: [PATCH 5.10 62/63] sched/idle: Make the idle timer expire in hard interrupt context Date: Fri, 24 Sep 2021 14:45:02 +0200 Message-Id: <20210924124336.389554292@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924124334.228235870@linuxfoundation.org> References: <20210924124334.228235870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior [ Upstream commit 9848417926353daa59d2b05eb26e185063dbac6e ] The intel powerclamp driver will setup a per-CPU worker with RT priority. The worker will then invoke play_idle() in which it remains in the idle poll loop until it is stopped by the timer it started earlier. That timer needs to expire in hard interrupt context on PREEMPT_RT. Otherwise the timer will expire in ksoftirqd as a SOFT timer but that task won't be scheduled on the CPU because its priority is lower than the priority of the worker which is in the idle loop. Always expire the idle timer in hard interrupt context. Reported-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20210906113034.jgfxrjdvxnjqgtmc@linutronix.de Signed-off-by: Sasha Levin --- kernel/sched/idle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 36b545f17206..2593a733c084 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -372,10 +372,10 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns) cpuidle_use_deepest_state(latency_ns); it.done = 0; - hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); it.timer.function = idle_inject_timer_fn; hrtimer_start(&it.timer, ns_to_ktime(duration_ns), - HRTIMER_MODE_REL_PINNED); + HRTIMER_MODE_REL_PINNED_HARD); while (!READ_ONCE(it.done)) do_idle(); -- 2.33.0