Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2077361ybp; Thu, 10 Oct 2019 01:46:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqydfP8eI21K7j68RQ/psTN0xGigvbQ5jyPsDPaUA4almZsPEikjRRX+ej/UVpV61+v6FZ59 X-Received: by 2002:a17:907:4090:: with SMTP id nt24mr7197216ejb.122.1570697210499; Thu, 10 Oct 2019 01:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697210; cv=none; d=google.com; s=arc-20160816; b=tmrgzMHdG4JaFLuo/Y3oJoEfcdE2ujyA2+7k1zdJwNPts2kE9W673tOMJCn2LGh88L Q4m1vsLUjcAF6lbUCQIT9aG4c5rlKhfBWfxND3REM3dr/rg8wEYzpgg9Zn4MOIcDt0Yo KlGeZtA5gCM3AyzgLXngmXU0r0Wmr7Fx0tiqzDTsXQSA7RUVu1+PyUlrHbm7GfJbyvpd BkLBpr7ZL9pmkAygnlqvfqOviGC4qiNna5bYK81iOBHE/dRi5fvLgGrCVYWmFRb2CHtz +WUqdNPAGQpMxCJ5/PeVT0lFXf+PeUhdzpncrXOKl5+A7bBjg0tH6fl+hL31CNtSaQI8 yCLA== 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=deu8CZXJ+va89r43GPW3tg+RxRaENBa/vaYG1LQBEus=; b=XbsINQpL/pd6+NkhGL7odJa1xywgfbmDAaXUiTIrdnFC0gd9QGwOsN10PNNHaSKUab IywCrHyUTgVB898V7BHvx8uqrFkSVAvpSEc910JP2hZs/usdOAIom03XLI6+NtmFCKOb qP1ZWmz0WaGN3iNxm/Jcap4zRpHNXMbPD8LGh+hnvVswkcYs8Fotn0dtLWZBT+tJYlNy gEBqjfv3weP6I6gdf7bQdkFKhVidMNIRWmncVQ/wTqAtzopz+tLV66IK9SDEYh9R/xIi Q+Jd1e0QDRuh6daWsTcmdvGv0hfdUCFJEDmhNJObVOd3qIctSCeByBfOlsfAhyccf/Ja UApA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qKAQpfXo; 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 u11si2685371ejr.234.2019.10.10.01.46.27; Thu, 10 Oct 2019 01:46:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=qKAQpfXo; 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 S2388658AbfJJInF (ORCPT + 99 others); Thu, 10 Oct 2019 04:43:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:47678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388649AbfJJInA (ORCPT ); Thu, 10 Oct 2019 04:43:00 -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 76CCB21929; Thu, 10 Oct 2019 08:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696980; bh=rmFIcT6ApW+UImpgfJcNSApiJXk5nsSOmBRfCxYD6bE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKAQpfXo8MGjZT/wLCnxrab27F5AqCwKZWqjmfFeReK6g66x9OEHktavj6QtxZ4A0 GuAnANsHtj3eeMtXdDjm8G8MScw4wB5tFTsOTiPNtWVxseMVqCwUxMAjJh9R7Thvyu SdK1G72WwNbH+JEsqXcUmI8tKBWz0QVWENnWqHAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Desnoyers , "Peter Zijlstra (Intel)" , Chris Metcalf , Christoph Lameter , "Eric W. Biederman" , Kirill Tkhai , Linus Torvalds , Mike Galbraith , Oleg Nesterov , "Paul E. McKenney" , Russell King - ARM Linux admin , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.3 121/148] sched/membarrier: Fix private expedited registration check Date: Thu, 10 Oct 2019 10:36:22 +0200 Message-Id: <20191010083618.395675320@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@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: Mathieu Desnoyers [ Upstream commit fc0d77387cb5ae883fd774fc559e056a8dde024c ] Fix a logic flaw in the way membarrier_register_private_expedited() handles ready state checks for private expedited sync core and private expedited registrations. If a private expedited membarrier registration is first performed, and then a private expedited sync_core registration is performed, the ready state check will skip the second registration when it really should not. Signed-off-by: Mathieu Desnoyers Signed-off-by: Peter Zijlstra (Intel) Cc: Chris Metcalf Cc: Christoph Lameter Cc: Eric W. Biederman Cc: Kirill Tkhai Cc: Linus Torvalds Cc: Mike Galbraith Cc: Oleg Nesterov Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Russell King - ARM Linux admin Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20190919173705.2181-2-mathieu.desnoyers@efficios.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/sched/membarrier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c index aa8d758041088..5110d91b1b0ea 100644 --- a/kernel/sched/membarrier.c +++ b/kernel/sched/membarrier.c @@ -226,7 +226,7 @@ static int membarrier_register_private_expedited(int flags) * groups, which use the same mm. (CLONE_VM but not * CLONE_THREAD). */ - if (atomic_read(&mm->membarrier_state) & state) + if ((atomic_read(&mm->membarrier_state) & state) == state) return 0; atomic_or(MEMBARRIER_STATE_PRIVATE_EXPEDITED, &mm->membarrier_state); if (flags & MEMBARRIER_FLAG_SYNC_CORE) -- 2.20.1