Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756538AbcLASZw (ORCPT ); Thu, 1 Dec 2016 13:25:52 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:37924 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbcLASZu (ORCPT ); Thu, 1 Dec 2016 13:25:50 -0500 Date: Thu, 1 Dec 2016 19:25:42 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , David Daney , Ingo Molnar , Steven Rostedt , Sebastian Siewior , Will Deacon , Mark Rutland , stable@vger.kernel.org Subject: Re: [patch 1/4] rtmutex: Prevent dequeue vs. unlock race Message-ID: <20161201182542.GP3045@worktop.programming.kicks-ass.net> References: <20161130205431.629977871@linutronix.de> <20161130210030.351136722@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161130210030.351136722@linutronix.de> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 795 Lines: 17 On Wed, Nov 30, 2016 at 09:04:41PM -0000, Thomas Gleixner wrote: > It's remarkable that the test program provided by David triggers on ARM64 > and MIPS64 really quick, but it refuses to reproduce on x8664, while the > problem exists there as well. That refusal might explain that this got not > discovered earlier despite the bug existing from day one of the rtmutex > implementation more than 10 years ago. > - clear_rt_mutex_waiters(lock); So that compiles into: andq $0xfffffffffffffffe,0x48(%rbx) With is a RmW memop. Now per the architecture documents we can decompose that into a normal load-store and the race exists. But I would not be surprised if that starts with the cacheline in exclusive mode (because it knows it will do the store). Which makes it a very tiny race indeed.