From patchwork Wed Jan 21 10:47:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 43442 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3330F240D5 for ; Wed, 21 Jan 2015 10:47:37 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id bs8sf14326940wib.1 for ; Wed, 21 Jan 2015 02:47:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=1lOYFiIFwHeGpi71UB0kdLso7iqQGnCEQ2tAFu/v6Ho=; b=cmAWXQALDxmfgwQtnbWIulbgxZy3TqtxlSRPpjS4U0oxn6/eI/fN56XsoFSkOeSy6l HJD4fnCqX1sx8K+OVYFN4hkNUvnay5lZQOeikenJSQmqGwYn+VsCe4KnctELth0kzn+7 bHqw3KUEC4/4LH2Jpfyro3VVNF82q5nV1wFuWh8Ez7fClPaBjrrATFMUexDfG+JM4SA2 PV8l0dEf6y2Ua6FFtw3a1sVywg/Wob7mdlr0G5SjHLccsRNAX+W+w0EwoljkiHwODRu4 av+Cr25fJP8sj527W2nVriDm12X9xUy0/Hh9ckWNyPkiJWHHSFnOpGksgyXit8Obvbp7 Hvxw== X-Gm-Message-State: ALoCoQlnm+OJlf/VM8jXjuyEvK1QtmXXbuWhxpsTT59J0OVqzrgOWA8MX+ZIfEpgxt/QyHhEnc33 X-Received: by 10.180.108.197 with SMTP id hm5mr1461066wib.4.1421837256532; Wed, 21 Jan 2015 02:47:36 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.231 with SMTP id kt7ls19156lac.52.gmail; Wed, 21 Jan 2015 02:47:36 -0800 (PST) X-Received: by 10.152.8.11 with SMTP id n11mr42403184laa.38.1421837256372; Wed, 21 Jan 2015 02:47:36 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id ld3si18935195lac.115.2015.01.21.02.47.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 02:47:36 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id gm9so13328113lab.0 for ; Wed, 21 Jan 2015 02:47:36 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr43979017lbl.25.1421837256233; Wed, 21 Jan 2015 02:47:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1731497lbb; Wed, 21 Jan 2015 02:47:35 -0800 (PST) X-Received: by 10.194.85.17 with SMTP id d17mr10701174wjz.61.1421837255574; Wed, 21 Jan 2015 02:47:35 -0800 (PST) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com. [74.125.82.178]) by mx.google.com with ESMTPS id jy4si10824290wid.62.2015.01.21.02.47.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 02:47:35 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.178 as permitted sender) client-ip=74.125.82.178; Received: by mail-we0-f178.google.com with SMTP id p10so42300279wes.9 for ; Wed, 21 Jan 2015 02:47:35 -0800 (PST) X-Received: by 10.194.80.193 with SMTP id t1mr60863290wjx.8.1421837255246; Wed, 21 Jan 2015 02:47:35 -0800 (PST) Received: from harvey.bri.st.com (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id be2sm24963393wjb.38.2015.01.21.02.47.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2015 02:47:34 -0800 (PST) Message-ID: <54BF83C9.5060300@linaro.org> Date: Wed, 21 Jan 2015 10:47:37 +0000 From: Daniel Thompson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Stephen Boyd , Thomas Gleixner , Jason Cooper CC: Russell King , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal , Dirk Behme , Daniel Drake , Dmitry Pervushin , Tim Sander , Steven Rostedt Subject: Re: [PATCH 3.19-rc2 v14 0/7] arm: Implement arch_trigger_all_cpu_backtrace References: <1415968543-29469-1-git-send-email-daniel.thompson@linaro.org> <1421144818-14036-1-git-send-email-daniel.thompson@linaro.org> <54BE2D15.9080606@linaro.org> <54BEC04D.1050402@codeaurora.org> In-Reply-To: <54BEC04D.1050402@codeaurora.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 20/01/15 20:53, Stephen Boyd wrote: > On 01/20/2015 02:25 AM, Daniel Thompson wrote: >> On 13/01/15 10:26, Daniel Thompson wrote: >>> Hi Thomas, Hi Jason: >>> Patches 1 to 3 are for you (and should be separable from the rest >>> of the series). The patches haven't changes since the last time >>> I posted them. The changes in v14 tidy up the later part of the >>> patch set in order to share more code between x86 and arm. >> No review comments! Have I finally got this right? >> >> If so it possible and/or sensible to get patches 1-3 in a tree that >> feeds linux-next. I'd really like the gic changes to meet the various >> ARM build and boot bots. > > With this patchset, is it possible to call sched_clock() from within NMI > context? I ask because the generic sched_clock() code is not NMI safe > today. We were planning on making it NMI safe by doing something similar > to what was done for ktime_get_mono_fast_ns() but we haven't gotten > around to it. Mostly because no architecture that uses generic > sched_clock() has support for NMIs right now. I've not done any work to make sched_clock() safe to call from NMI. However since my patchset does not introduce any calls to sched_clock() from NMI I think this is OK! I ported Steven Rostedt's work to make arch_trigger_all_cpu_backtrace() safe from NMI from x86 to ARM. One result of Steven's approach are that printk() timestamping is deferred until we return to normal context. Thus even with CONFIG_PRINTK_TIME we do not call local_clock() during NMI processing. To confirm the above I have added the code below to my kernel and ran it with a fairly paranoid set of debugging options. The check does not fire. Daniel. diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 630dd2372238..fea0deeb524b 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -111,8 +111,10 @@ extern void warn_slowpath_null(const char *file, const int line); int __ret_warn_once = !!(condition); \ \ if (unlikely(__ret_warn_once)) \ - if (WARN_ON(!__warned)) \ + if (unlikely(!__warned)) { \ __warned = true; \ + __WARN(); \ + } \ unlikely(__ret_warn_once); \ }) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 01d2d15aa662..81ea469b7e68 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -63,6 +63,8 @@ unsigned long long notrace sched_clock(void) u64 cyc; unsigned long seq; + WARN_ON_ONCE(in_nmi()); + if (cd.suspended) return cd.epoch_ns;