Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp955268imm; Wed, 8 Aug 2018 08:24:34 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzG1gSyXXmY/A6eEdCPMMbpuOUgBZt+C07ojYNmJoZwApWSGzGX0sjkrFNrXWb0bw+tzOsY X-Received: by 2002:a17:902:7486:: with SMTP id h6-v6mr3082277pll.165.1533741874454; Wed, 08 Aug 2018 08:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533741874; cv=none; d=google.com; s=arc-20160816; b=1KY6DbQ3vzboZ9RHdpg4W5wMIY65ehy93V1dDJwaRKJBLwisxx/2IdGvVCJU3hnMuJ 51iDU1a+LpnOZD1UaheLcOfGLuR6vrJO3qOFE15YO4uvi2Km4poK/mjFAUjwbJwsuQsE 1GKS/2jWOkhd0rpt1YyT+w+ThTSGglK25pWWCDxkAzNEA6+5nDVMgcRQMl/9v3WI30vK g+7ImCQUA003FMQQufnD2AwiJn17F5xua+jprRqshEVoHjl+i31Xapv8mTeWs2y3Xmft mjHNPojei89QoW1HxtL6HrJpBrUBVQVv2TBjB4GdsNTvBMJ1SPPePmnbsTZ6XZ0LeEQm +Nng== 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 :arc-authentication-results; bh=SJ3T5rGwyzfO6eIATg488THJ4ByHICiCt2rHfCUqXX4=; b=JjWngcRJnpq4B8V83j2gHKB2K4Fk2b9CCwkss/EqIsjkVC3x24e2AbRw56KzPd+ZlN bLQonDyfAR3u3nMcQFWpGkjLCFx/Lpw0oelNRi0QSM/yGbjwlXNi+pK00WNQ8B0w8f+q rXd2+7gALPWs7Lo35xKQFx90E7VIC77r+xdaaG0u2Si57GjkjNKDJLzdub4MtrDgwMmc b4joODWJgkpAqaJ9ZzVRymmwqCr6x935TjoFgzAQkr41JGLz9pAUgiiEIzYxzNA/6HET RDkguEblZ9TomKGkqq/2UvQ/4tfm0/BOxMP07XbYxArij29P3TOZVguItRI9M2nraLdu Sp9A== 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 a33-v6si3523256pld.269.2018.08.08.08.24.18; Wed, 08 Aug 2018 08:24:34 -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 S1727759AbeHHRnV (ORCPT + 99 others); Wed, 8 Aug 2018 13:43:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:54544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbeHHRnV (ORCPT ); Wed, 8 Aug 2018 13:43:21 -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 E9C6E21990; Wed, 8 Aug 2018 15:23:10 +0000 (UTC) Date: Wed, 8 Aug 2018 11:23:09 -0400 From: Steven Rostedt To: "Paul E. McKenney" Cc: Joel Fernandes , Joel Fernandes , LKML , "Cc: Android Kernel" , Boqun Feng , Byungchul Park , Ingo Molnar , Masami Hiramatsu , Mathieu Desnoyers , Namhyung Kim , Peter Zijlstra , Thomas Glexiner , Tom Zanussi Subject: Re: [PATCH v12 3/3] tracing: Centralize preemptirq tracepoints and unify their usage Message-ID: <20180808112309.6edda174@gandalf.local.home> In-Reply-To: <20180808150558.GO24813@linux.vnet.ibm.com> References: <20180807215522.04114097@vmware.local.home> <20180807222856.3ede96e7@vmware.local.home> <20180808084629.3290d1d6@gandalf.local.home> <20180808130302.GJ24813@linux.vnet.ibm.com> <20180808090724.41677176@gandalf.local.home> <20180808143310.GL24813@linux.vnet.ibm.com> <20180808104910.2ced5e51@gandalf.local.home> <20180808150558.GO24813@linux.vnet.ibm.com> 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 Wed, 8 Aug 2018 08:05:58 -0700 "Paul E. McKenney" wrote: > On Wed, Aug 08, 2018 at 10:49:10AM -0400, Steven Rostedt wrote: > > On Wed, 8 Aug 2018 07:33:10 -0700 > > "Paul E. McKenney" wrote: > > > > > On Wed, Aug 08, 2018 at 09:07:24AM -0400, Steven Rostedt wrote: > > > > On Wed, 8 Aug 2018 06:03:02 -0700 > > > > "Paul E. McKenney" wrote: > > > > > > > > > What's wrong with a this_cpu_inc()? It's atomic for the CPU. Although > > > > > > it wont be atomic for the capture of the idx. But I also don't see > > > > > > interrupts being disabled, thus an NMI is no different than any > > > > > > interrupt doing the same thing, right? > > > > > > > > > > On architectures without increment-memory instructions, if you take an NMI > > > > > between the load from sp->sda->srcu_lock_count and the later store, you > > > > > lose a count. Note that both __srcu_read_lock() and __srcu_read_unlock() > > > > > do increments of different locations, so you cannot rely on the usual > > > > > "NMI fixes up before exit" semantics you get when incrementing and > > > > > decrementing the same location. > > > > > > > > And how is this handled in the interrupt case? Interrupts are not > > > > disabled here. > > > > > > Actually, on most architectures interrupts are in fact disabled: > > > > > > #define this_cpu_generic_to_op(pcp, val, op) \ > > > do { \ > > > unsigned long __flags; \ > > > raw_local_irq_save(__flags); \ > > > raw_cpu_generic_to_op(pcp, val, op); \ > > > raw_local_irq_restore(__flags); \ > > > } while (0) > > > > > > NMIs, not so much. > > > > And do these archs have NMIs? > > It would appear so: Well the next question is, which of these archs that use it are in this list. > > $ find . -name 'Kconfig*' -exec grep -l 'select HAVE_NMI\>' {} \; > ./arch/sparc/Kconfig > ./arch/s390/Kconfig > ./arch/arm/Kconfig > ./arch/arm64/Kconfig > ./arch/mips/Kconfig > ./arch/sh/Kconfig > ./arch/powerpc/Kconfig Note, I know that powerpc "imitates" an NMI. It just sets the NMI as a priority higher than other interrupts. > ./arch/x86/Kconfig > And we get this: $ git grep this_cpu_add_4 arch/arm64/include/asm/percpu.h:#define this_cpu_add_4(pcp, val) _percpu_add(pcp, val) arch/s390/include/asm/percpu.h:#define this_cpu_add_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +) arch/s390/include/asm/percpu.h:#define this_cpu_add_4(pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int) arch/x86/include/asm/percpu.h:#define this_cpu_add_4(pcp, val) percpu_add_op((pcp), val) Which leaves us with sparc, arm, mips, sh and powerpc. sh is almost dead, and powerpc can be fixed, which I guess leaves us with sparc, arm and mips. -- Steve > Thanx, Paul