From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755685AbbCFTju (ORCPT ); Fri, 6 Mar 2015 14:39:50 -0500 Received: from mail.efficios.com ([78.47.125.74]:32804 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbbCFTjt (ORCPT ); Fri, 6 Mar 2015 14:39:49 -0500 Date: Fri, 6 Mar 2015 19:39:44 +0000 (UTC) From: Mathieu Desnoyers To: Steven Rostedt Cc: Linus Torvalds , "Paul E. McKenney" , Huang Ying , Lai Jiangshan , Lai Jiangshan , Peter Zijlstra , LKML , Ingo Molnar Message-ID: <148790040.241085.1425670784201.JavaMail.zimbra@efficios.com> In-Reply-To: <20150306140347.64cfcad1@gandalf.local.home> References: <995381344.227770.1425597484864.JavaMail.zimbra@efficios.com> <950470583.228004.1425599331454.JavaMail.zimbra@efficios.com> <402283060.238174.1425652523685.JavaMail.zimbra@efficios.com> <20150306140347.64cfcad1@gandalf.local.home> Subject: Re: Possible lock-less list race in scheduler_ipi() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [173.246.22.116] X-Mailer: Zimbra 8.0.7_GA_6021 (ZimbraWebClient - FF36 (Linux)/8.0.7_GA_6021) Thread-Topic: Possible lock-less list race in scheduler_ipi() Thread-Index: dPkLW8IUaBO8lzFV7bp0u3e6ikC0gQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > From: "Steven Rostedt" > To: "Mathieu Desnoyers" > Cc: "Linus Torvalds" , "Paul E. McKenney" , "Huang Ying" > , "Lai Jiangshan" , "Lai Jiangshan" , "Peter > Zijlstra" , "LKML" , "Ingo Molnar" > Sent: Friday, March 6, 2015 2:03:47 PM > Subject: Re: Possible lock-less list race in scheduler_ipi() > > On Fri, 6 Mar 2015 14:35:23 +0000 (UTC) > Mathieu Desnoyers wrote: > > > > Indeed, the compiler should never reorder loads/stores from/to > > same memory location from a program order POV. What I had in mind > > is a bit more far-fetched though: it would involve having the compiler > > reorder this load after a store to another memory location, which > > would in turn allow another execution context (interrupt or thread) > > to corrupt the list. > > You mean on another CPU? Because the code you are worried about has > interrupts disabled. I'm worried that another CPU could issue try_to_wake_up() on a task concurrently with the llist iteration within sched_ttwu_pending(). AFAIU, ttwu_queue_remote() is called from ttwu_queue() without holding the rq lock. So I'm wondering what prevents corruption of the wake_list in this situation. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com