From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 064B3C64E90 for ; Tue, 1 Dec 2020 15:02:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7951020691 for ; Tue, 1 Dec 2020 15:02:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dgSYvfIL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391558AbgLAPCI (ORCPT ); Tue, 1 Dec 2020 10:02:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389514AbgLAPCI (ORCPT ); Tue, 1 Dec 2020 10:02:08 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07F6C0613CF for ; Tue, 1 Dec 2020 07:01:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jnht86pD3yq7U+rFN+c+PZKSrM6gKzPyOSAK99iCZwQ=; b=dgSYvfILuoEV3q8g19JLd64Hlg A5nve0zQ+bttY1SBLgg81B4wWGS0Ur8aLNv6AptVT2HWC9qkAQITGaBEjpwbRWOIsKngV0ggDvVhw 6+GmOrxg4pKonhOcSdcZE+mx9+ywo/ZOrUVA9vehhAnOih30EMkENKotnq2AXjoZXvUxtHRrCd62f n8UPe3uW+HMeh3J8tgBZNX4EuIFMdhGvv7Sc7ZlgVxHfOGL0sOisiFxLan1m3a1NvoHtnP4WTpLsu C+PEA/Uux/W4fYWOXfODSbnfCEAkPOx3BNKyuTttM7+/asI/zvaMeSIt7zuh+JOuSRcxd1aoa18Ws /L5L/p6A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk79Z-0006nC-0s; Tue, 01 Dec 2020 15:01:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 18EE63003E1; Tue, 1 Dec 2020 16:01:15 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 03C332BAB3CBF; Tue, 1 Dec 2020 16:01:14 +0100 (CET) Date: Tue, 1 Dec 2020 16:01:14 +0100 From: Peter Zijlstra To: Frederic Weisbecker Cc: Thomas Gleixner , LKML , Tony Luck , Vasily Gorbik , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Christian Borntraeger , Fenghua Yu , Heiko Carstens Subject: Re: [PATCH 4/5] irqtime: Move irqtime entry accounting after irq offset incrementation Message-ID: <20201201150114.GZ2414@hirez.programming.kicks-ass.net> References: <20201201001226.65107-1-frederic@kernel.org> <20201201001226.65107-5-frederic@kernel.org> <20201201092011.GS2414@hirez.programming.kicks-ass.net> <87im9lhibd.fsf@nanos.tec.linutronix.de> <20201201114026.GB72897@lothringen> <87blfdhcp2.fsf@nanos.tec.linutronix.de> <20201201143545.GC72897@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201201143545.GC72897@lothringen> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 01, 2020 at 03:35:45PM +0100, Frederic Weisbecker wrote: > And that one too makes things simple. But note that > > account_hardirq_enter_time() > > will still need some preempt count checks to see if > this is a nested hardirq, a hardirq interrupting a softirq > or a hardirq interrupting a task. So the current tests get that all correct in a single function. Splitting it out will just result in more lines to get wrong. That is, I don't think you can do it saner than: account_softirq_enter() := irqtime_account_irq(curr, SOFTIRQ_OFFSET); account_softirq_exit() := irqtime_account_irq(curr, 0); account_hardirq_enter() := irqtime_account_irq(curr, HARDIRQ_OFFSET); account_hardirq_exit() := irqtime_account_irq(curr, 0); Fundamentally you have to determine the previous context to determine where to account the delta to. Note that when the previous context is task context we throw away the delta.