Received: by 10.192.165.148 with SMTP id m20csp5291113imm; Tue, 1 May 2018 12:20:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo3xGqiNCCPaLMv2L8ZtOpU/c/VZ76eCebjRgj95dv18L6leeZwsOY9RGWz8sKWedVpGbNm X-Received: by 2002:a63:ae06:: with SMTP id q6-v6mr13852300pgf.350.1525202429617; Tue, 01 May 2018 12:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525202429; cv=none; d=google.com; s=arc-20160816; b=nbxut5hw3xLPqkY9Af8uaGE8b+rNZTHWvSbi8CoZ2B6L83KTtNMjQdaEQd8wGqCMLU ZTv84IywiNtYOSphzz7eumGsCXJHCqRJaVlh7o3L5YbHYJPEJ6ZpXrbI4FOHgQy5DnuX 27qcgK6ItttD8vQZDZrNdooJv1LqIyG56XSTWG1XDq3YhuPzafVU7W2hRIgS7rpTC95J 0vMGOctEeZO2ak7JSYXj+AP03gi2A2ROITf87k0D2ojlMAkE7IlyI5Yek3jlnQ1M12+a uGP31DBSyKO+j6B7lUBKecT1Qr5SBIQ8aAej5ZTFG+8fZJjrZIECslpKKPI7JIbuvJo9 I6HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=as0ab1BHdupEiZurQSL7NkW3CVKzOZlG6x3tyLrhOtY=; b=ff24phscoaSSoweGqHatg9E3MwkhZbkK+rUj1/6zRbzcOxWiZP6RwxImkp5HnBNaVK 1WNSQcPHbdzAyTMGgKWZSNXztwziACYcAqlYL1Pqe9WAsJzHAn0p0FKLndCK9nvzNxDy oCKt+qRWDLKoAx3z2vkZgIQjkF1OqqmUWUyAZxofp2U3yPxBMZze632lG0nOl5sRBd2m 3C7p1V9KiWHyL5yzrnlP+WaY+G/44hgqgp4FnAEnRar3ZOlFdBMSYwJ9stCFBNOo/Lsg nSQ5WXMLhsoirUHV9GcSy0YKmX8UTpFXg+up/0yYl9iWmNq5yXBO6Fd3BRxIcNNWTiaT yMvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=W+7aKRfM; 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 y25si1559326pfn.248.2018.05.01.12.20.13; Tue, 01 May 2018 12:20:29 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=W+7aKRfM; 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 S1750823AbeEATUD (ORCPT + 99 others); Tue, 1 May 2018 15:20:03 -0400 Received: from merlin.infradead.org ([205.233.59.134]:49164 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbeEATUC (ORCPT ); Tue, 1 May 2018 15:20:02 -0400 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=as0ab1BHdupEiZurQSL7NkW3CVKzOZlG6x3tyLrhOtY=; b=W+7aKRfMlZxkicr0V9CH/pTlS 0XC/I2SFoxraxO3YTKeDUUdZvvOuzrZnVTnQg8DFiFZDK+lKdDa6iH3rMmXrfLMUS/pDJeIJEuli7 QATRl3GJ3CggNTRj2FDzonw1+uR+pIxT3lSdFhI7DnHs7P6oWebzOtnt+ka0dZ98LUYiyx8pOXSk0 TvYwG2TmIyLf0nMiP/ExNoHiSKeZl0+ofScXRHValhKsnlg6dAzAv6vx3fkdvSvFllb9EXtk8Xao1 gfyd0RwjQxjNLcovzb/+Jm2QFdPoZOoxxfkAWtGQDUqkGwkdNt1rDJzWwT6wG0vsvOD+/SchvQ3GF fz/5SNKWw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDaoc-0007ik-49; Tue, 01 May 2018 19:19:54 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 357B32029FA14; Tue, 1 May 2018 21:19:51 +0200 (CEST) Date: Tue, 1 May 2018 21:19:51 +0200 From: Peter Zijlstra To: Steven Rostedt 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: <20180501191951.GJ12217@hirez.programming.kicks-ass.net> References: <20171116161506.19691-1-npiggin@gmail.com> <20180501144620.1e832a09@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180501144620.1e832a09@gandalf.local.home> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.