From patchwork Fri Feb 21 21:24:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Zanussi X-Patchwork-Id: 213207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D287C35669 for ; Fri, 21 Feb 2020 21:26:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5589924650 for ; Fri, 21 Feb 2020 21:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582320419; bh=ydTYfYBQgD78+JZJ9VmOf5XD18xkNDBLsvo8rGpCkFY=; h=From:To:Subject:Date:In-Reply-To:References:In-Reply-To: References:List-ID:From; b=e5jhXoGX8YTaNO2p4jkuCOjBOVHeziuIYymeSP+ml1SW0CKDrpW6WnRCsJss8d4VI pc+AYxmybFsFDNNTvhw8/1+y70N4XOoenBRPZ/hQFJnXmYFKi3LAecE4cKqWkfq0JV pMNEIAuQy4lbiU4mVyIVaM1kmOkZ/cmwb9Xi8mTA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728722AbgBUVZR (ORCPT ); Fri, 21 Feb 2020 16:25:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:38992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726683AbgBUVZR (ORCPT ); Fri, 21 Feb 2020 16:25:17 -0500 Received: from localhost.localdomain (c-98-220-238-81.hsd1.il.comcast.net [98.220.238.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C60D24653; Fri, 21 Feb 2020 21:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582320316; bh=ydTYfYBQgD78+JZJ9VmOf5XD18xkNDBLsvo8rGpCkFY=; h=From:To:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Bx6gdwaSZKb92r5uvPedbvlrB7UwuiSfC5wmJlLJr3fuq5jP+EUPc8Zx/M8rGMHOy mU5xwlSeEFhpBwoUUghFoxm2+29tifndEEAx7vq9+fhMj6NiQuiDhU+rw6v/0L2TpW /sk5F90myeAxzz+LXRpvb8+BLfD43EyNNkpL9C4g= From: zanussi@kernel.org To: LKML , linux-rt-users , Steven Rostedt , Thomas Gleixner , Carsten Emde , John Kacur , Sebastian Andrzej Siewior , Daniel Wagner , Tom Zanussi Subject: [PATCH RT 02/25] x86: preempt: Check preemption level before looking at lazy-preempt Date: Fri, 21 Feb 2020 15:24:30 -0600 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-rt-users-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: Sebastian Andrzej Siewior v4.14.170-rt75-rc1 stable review patch. If anyone has any objections, please let me know. ----------- [ Upstream commit 19fc8557f2323c52b26561651ed4d51fc688a740 ] Before evaluating the lazy-preempt state it must be ensure that the preempt-count is zero. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Tom Zanussi --- arch/x86/include/asm/preempt.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h index f66708779274..afa0e42ccdd1 100644 --- a/arch/x86/include/asm/preempt.h +++ b/arch/x86/include/asm/preempt.h @@ -96,6 +96,8 @@ static __always_inline bool __preempt_count_dec_and_test(void) if (____preempt_count_dec_and_test()) return true; #ifdef CONFIG_PREEMPT_LAZY + if (preempt_count()) + return false; if (current_thread_info()->preempt_lazy_count) return false; return test_thread_flag(TIF_NEED_RESCHED_LAZY);