Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753261AbbDGSMP (ORCPT ); Tue, 7 Apr 2015 14:12:15 -0400 Received: from mail-ie0-f179.google.com ([209.85.223.179]:34571 "EHLO mail-ie0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbbDGSMK (ORCPT ); Tue, 7 Apr 2015 14:12:10 -0400 MIME-Version: 1.0 In-Reply-To: <20150407120403.GN21418@twins.programming.kicks-ass.net> References: <1424395866-81589-1-git-send-email-tmac@hp.com> <1428369962-74723-1-git-send-email-tmac@hp.com> <1428369962-74723-2-git-send-email-tmac@hp.com> <1428407236.3152.81.camel@gmail.com> <20150407120403.GN21418@twins.programming.kicks-ass.net> Date: Tue, 7 Apr 2015 11:12:09 -0700 X-Google-Sender-Auth: yJrYnghMT1WpgoSY4OBVdN4R7o4 Message-ID: Subject: Re: [PATCH v2 1/2] rtmutex Real-Time Linux: Fixing kernel BUG at kernel/locking/rtmutex.c:997! From: Jason Low To: Peter Zijlstra Cc: Mike Galbraith , Thomas Gleixner , Thavatchai Makphaibulchoke , Steven Rostedt , LKML , Ingo Molnar , linux-rt-users , Jason Low Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1351 Lines: 35 On Tue, Apr 7, 2015 at 5:04 AM, Peter Zijlstra wrote: > That smells like something we should be able to do without a lock. > > If we use {READ,WRITE}_ONCE() on those two fields (->active_timers and > ->next_timer) we should be able to do this without the spinlock. Yeah, when atomics were suggested earlier, I was wondering if we could just use READ_ONCE/WRITE_ONCE. > Races here aren't really a problem I think, if you manage to install a > timer at the current jiffy and have already missed the tick you're in > the same boat. You get to wait for the next tick. The lock shouldn't be used in get_next_timer_interrupt() either right? unsigned long get_next_timer_interrupt(unsigned long now) { ... #ifdef CONFIG_PREEMPT_RT_FULL /* * On PREEMPT_RT we cannot sleep here. If the trylock does not * succeed then we return the worst-case 'expires in 1 tick' * value. We use the rt functions here directly to avoid a * migrate_disable() call. */ if (!spin_do_trylock(&base->lock)) return now + 1; #else -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/