From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753925AbbGaOCp (ORCPT ); Fri, 31 Jul 2015 10:02:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57529 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488AbbGaOCn (ORCPT ); Fri, 31 Jul 2015 10:02:43 -0400 Date: Fri, 31 Jul 2015 07:02:07 -0700 From: tip-bot for Oleg Nesterov Message-ID: Cc: oleg@redhat.com, srikar@linux.vnet.ibm.com, panand@redhat.com, torvalds@linux-foundation.org, tglx@linutronix.de, luto@amacapital.net, linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com Reply-To: hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, luto@amacapital.net, tglx@linutronix.de, panand@redhat.com, srikar@linux.vnet.ibm.com, oleg@redhat.com In-Reply-To: <20150721134036.GA4799@redhat.com> References: <20150721134036.GA4799@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] uprobes: Fix the waitqueue_active() check in xol_free_insn_slot() Git-Commit-ID: 2a742cedcf13572999436676cbe36c3a9b733b0f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2a742cedcf13572999436676cbe36c3a9b733b0f Gitweb: http://git.kernel.org/tip/2a742cedcf13572999436676cbe36c3a9b733b0f Author: Oleg Nesterov AuthorDate: Tue, 21 Jul 2015 15:40:36 +0200 Committer: Ingo Molnar CommitDate: Fri, 31 Jul 2015 10:38:07 +0200 uprobes: Fix the waitqueue_active() check in xol_free_insn_slot() The xol_free_insn_slot()->waitqueue_active() check is buggy. We need mb() after we set the conditon for wait_event(), or xol_take_insn_slot() can miss the wakeup. Signed-off-by: Oleg Nesterov Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Pratyush Anand Cc: Srikar Dronamraju Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20150721134036.GA4799@redhat.com Signed-off-by: Ingo Molnar --- kernel/events/uprobes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 2d5b7bd..4e5e979 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1337,6 +1337,7 @@ static void xol_free_insn_slot(struct task_struct *tsk) clear_bit(slot_nr, area->bitmap); atomic_dec(&area->slot_count); + smp_mb__after_atomic(); /* pairs with prepare_to_wait() */ if (waitqueue_active(&area->wq)) wake_up(&area->wq);