From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751899AbbBEGXx (ORCPT ); Thu, 5 Feb 2015 01:23:53 -0500 Received: from smtp.codeaurora.org ([198.145.11.231]:44891 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751080AbbBEGXw (ORCPT ); Thu, 5 Feb 2015 01:23:52 -0500 Date: Wed, 4 Feb 2015 22:23:49 -0800 From: Stephen Boyd To: Steven Rostedt Cc: Daniel Thompson , Thomas Gleixner , John Stultz , linux-kernel@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, Sumit Semwal , Russell King , Will Deacon , Catalin Marinas Subject: Re: [PATCH v3 4/4] sched_clock: Avoid deadlock during read from NMI Message-ID: <20150205062349.GA28561@codeaurora.org> References: <1421859236-19782-1-git-send-email-daniel.thompson@linaro.org> <1422644602-11953-1-git-send-email-daniel.thompson@linaro.org> <1422644602-11953-5-git-send-email-daniel.thompson@linaro.org> <20150205012351.GC30372@codeaurora.org> <20150204204838.65411577@grimm.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150204204838.65411577@grimm.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/04, Steven Rostedt wrote: > On Wed, 4 Feb 2015 17:23:51 -0800 > Stephen Boyd wrote: > > > On 01/30, Daniel Thompson wrote: > > > @@ -98,26 +98,50 @@ unsigned long long notrace sched_clock(void) > > > } > > > > > > /* > > > + * Updating the data required to read the clock. > > > + * > > > + * sched_clock will never observe mis-matched data even if called from > > > + * an NMI. We do this by maintaining an odd/even copy of the data and > > > + * steering sched_clock to one or the other using a sequence counter. > > > + * In order to preserve the data cache profile of sched_clock as much > > > + * as possible the system reverts back to the even copy when the update > > > + * completes; the odd copy is used *only* during an update. > > > + */ > > > +static void update_clock_read_data(struct clock_read_data *rd) > > > > notrace? > > Why? Isn't this for update, not for readers? > Good point. I was basing it on the fact that the caller, update_sched_clock() is marked notrace. It looks like it's always been that way (see commit 2f0778afac79 "ARM: 7205/2: sched_clock: allow sched_clock to be selected at runtime" from 2011-12-15 where it was introduced). So the correct thing would be to drop notrace from update_sched_clock(). -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project