Received: by 10.192.165.148 with SMTP id m20csp5307637imm; Tue, 1 May 2018 12:39:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpccYOT/WCc+ypa9cn7lEboBk7VcU9GdDm9KexN8HvrK6CzLZdYfzCa7XZuJFS7AHZGCTRP X-Received: by 2002:a17:902:6006:: with SMTP id r6-v6mr17049576plj.70.1525203548662; Tue, 01 May 2018 12:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525203548; cv=none; d=google.com; s=arc-20160816; b=hvAfpKgoWH5V+9XrbJ6tEw2rIIM/GoQ6B0eejJ0hICyKapx1oha5V/6a6kjE3rMQ1O FNPv9B3C9153NVmjPf4rwRqkcSIJgbbkpvBkMDViPXFqzrXUJlus8Ah7nyJc2DTtb/fG tB9ovVdV58tI9lw1C0xIltbPQjbWT10fTMxoRd9vMjAm99lx2ZMXMVKQAVp+H26i3O3J hfaMmFOgGgZb9Ru9WcBeCeUFbEJ010L7BplzeJvqtHZfG/zcSmkGtOalr/iupTsf9jwR m3xv7P88VIx1hAyBg/rWdcgAkJGKXegfwggeuEWrEFJjmQB9bj3DrUaxukWX4SDN/fiE wVBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=gI315iGR58bdpb4ItvteRdg6IU9ihzB9sYEpQYxR3WA=; b=Y5ruaPSRVs5jYSB/P8cAQWYBovBHZF+iaWcuFQQBQArs8jLvSJ3GrxVClslt9iFn6r 1ohmKCnBm2U/0DDipUc7FkjsnXFM5Pd8Jnwk3DGr2bSAxmJ1YyVuEzltZJpogEHe9Q3G wY7EPoRkTeGirfqEgLhP3yyd/CMXcuSWLiKE8BrC4iB+FnFDf8VONBUbljm3XatojjJ7 hAG02jOUqjn2iqveUJd+zH805usZVhwGTnWAMQMDy69zpSQf86VIntBzLrVQCvLAmcG5 akRUGVm6eX6eHgyXoox4iwMMFnYDEgIULQowlatYED/ysvuo6oJd0GKUosmEbFV3NHEa e/JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8-v6si1863648plr.333.2018.05.01.12.38.53; Tue, 01 May 2018 12:39:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750945AbeEATio (ORCPT + 99 others); Tue, 1 May 2018 15:38:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:58280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750755AbeEATin (ORCPT ); Tue, 1 May 2018 15:38:43 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D12623705; Tue, 1 May 2018 19:38:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D12623705 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Tue, 1 May 2018 15:38:40 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Nicholas Piggin , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing/irqtrace: only call trace_hardirqs_on/off when state changes Message-ID: <20180501153840.7281022a@gandalf.local.home> In-Reply-To: <20180501191951.GJ12217@hirez.programming.kicks-ass.net> References: <20171116161506.19691-1-npiggin@gmail.com> <20180501144620.1e832a09@gandalf.local.home> <20180501191951.GJ12217@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 1 May 2018 21:19:51 +0200 Peter Zijlstra wrote: > On Tue, May 01, 2018 at 02:46:20PM -0400, Steven Rostedt wrote: > > On Fri, 17 Nov 2017 02:15:06 +1000 > > Nicholas Piggin wrote: > > > > > In local_irq_save and local_irq_restore, only call irq tracing when > > > the flag state acutally changes. It is not unexpected for the state > > > to go disable->disable. > > > > > > This allows the irq tracing code to better track superfluous > > > enables and disables, and in future could issue warnings. For the > > > most part they are harmless, but they can indicate that the caller > > > has lost track of its irq state. > > > > I missed this before (that was a busy time, I missed a lot of emails > > then :-/ ). > > > > Anyway, this makes sense. > > > > Peter? > > I'm confused. The patch calls the trace hooks less often, so how can it > then better track superfluous calls? > > > > @@ -110,7 +110,8 @@ do { \ > > > #define local_irq_save(flags) \ > > > do { \ > > > raw_local_irq_save(flags); \ > > > - trace_hardirqs_off(); \ > > > + if (!raw_irqs_disabled_flags(flags)) \ > > > + trace_hardirqs_off(); \ > > > } while (0) > > Here we only call the trace hook when we actually did an ON->OFF change > and loose the call on OFF->OFF. > > > > @@ -118,9 +119,11 @@ do { \ > > > do { \ > > > if (raw_irqs_disabled_flags(flags)) { \ > > > raw_local_irq_restore(flags); \ > > > - trace_hardirqs_off(); \ > > > + if (!irqs_disabled()) \ > > > + trace_hardirqs_off(); \ > > Only call on ON->OFF, ignore OFF->OFF. > > > > } else { \ > > > - trace_hardirqs_on(); \ > > > + if (irqs_disabled()) \ > > > + trace_hardirqs_on(); \ > > > raw_local_irq_restore(flags); \ > > > } \ > > > } while (0) > > Only call on OFF->ON, ignore ON->ON. > > > Now, lockdep only minimally tracks these otherwise redundant operations; > see redundant_hardirqs_{on,off} counters, and loosing that doesn't seen > like a big issue. > > But I'm confused how this helps track superfluous things, it looks like > it explicitly tracks _less_ superfluous transitions. I think it is about triggering on OFF->OFF a warning, as that would only happen if we have: local_irq_save(flags); [..] local_irq_disable(); -- Steve