From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752219AbbC0Fiv (ORCPT ); Fri, 27 Mar 2015 01:38:51 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:39851 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751200AbbC0Fit (ORCPT ); Fri, 27 Mar 2015 01:38:49 -0400 Message-ID: <5514ECE3.6030200@linux.vnet.ibm.com> Date: Fri, 27 Mar 2015 00:38:43 -0500 From: "Suresh E. Warrier" User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Steven Rostedt CC: linux-kernel@vger.kernel.org, Frederic Weisbecker , Ingo Molnar , Paul Mackerras Subject: Re: [PATCH] ring-buffer: More precise time stamps for nested writes References: <1426827724-22200-1-git-send-email-warrier@linux.vnet.ibm.com> <5511EECD.90902@linux.vnet.ibm.com> <20150324191928.18b9f9f2@gandalf.local.home> In-Reply-To: <20150324191928.18b9f9f2@gandalf.local.home> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032705-0021-0000-0000-00000975E7B4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/24/2015 06:19 PM, Steven Rostedt wrote: > On Tue, 24 Mar 2015 18:10:05 -0500 > .. .. > There is no architecture where disabling interrupts is cheap. Actually, > enabling them is the killer. Doing function tracing shows the impact of > this rather well, as it would disable and enable interrupts for every > function call, which can get rather expensive in the sum of things, and > it does skew the timings and can make it more difficult to debug > heissenbugs. > On PPC64, enabling and disabling soft IRQs is simply a matter of setting/clearing a per-CPU global variable (in the per-CPU PACA structure), so it shouldn't be expensive unless an interrupt is pending when we re-enable, which should be rare. I ran a series of tests on a Power8 box and even with a cold cache, both the local_irq_save and local_irq_restore routines only took a few nanoseconds, although the restore was a little more expensive than the save. (The restore took about 80-160 ns on a cold cache and 20-30 ns on a warm one.) > That said, I feel your pain. I've had some ideas about doing this > without disabling interrupts. That is excellent! > But for now, what can be done is to have > a flag that is set that will implement this or not. Using > static_branch() to implement it such that when its off it has no effect. > Are you recommending that for now I use a static_branch() instead of a CONFIG option to fix this? I could do that but the resulting code will either be messier to read (with several if condition checks) or will require some duplication of code. My assumption is that the new CONFIG option when disabled should have negligible impact since the compiler inlines the functions. -suresh > In the mean time, I can go and revisit trying to have better timings > with nested writes. > > -- Steve >