Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp891592imm; Wed, 8 Aug 2018 07:28:35 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyk4P5OhMz+Gc1PtMZO7usbbYBu2blR283Zb5cafGDdhxtIr1V88RwBwycfWzTO8x60Yiwh X-Received: by 2002:a65:4107:: with SMTP id w7-v6mr2728422pgp.302.1533738515737; Wed, 08 Aug 2018 07:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533738515; cv=none; d=google.com; s=arc-20160816; b=XzgpVhApZpMxIh9B9m8vXpw+6t9khF2UZBg1JjPnCKK1XhznN9S8it+4gNT5+JIlLT 22lCrd9XiMi0sWEad+JTucXLM5kY7xzgwq7lNRvpgXl2a6abozgQj/utLo7XfG2v4T0z Ki12cw75FWuMPf6mJokDsSZpy+C0c3txigaFXXC4YbKTMIOY/pypV6ElwFDujxA2P2eR AATSvoHvKiPGVwYFdcbGDWI18AFFVJ0cnR+hvaDhZvv6DltCLR4IGQKQkWRL8ahSK2XJ dozwwz7A9urls2v0l2ir9tm3atNF5RJ3O0fHendCtDPouHEGMiwHHJ9gO3fyyNQlVP47 AoDw== 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=b4J/ywSKU8Jh3ogm641kKDSHuOc0LwQH2nxXyN/BBzI=; b=oLT3FnOM5B9rVSl83e20XrymBALpe+qR8W9GIuW9N4L2vR1VT9houq0dA+deTAffFA f1Lqfa3ePRMK+hzDRUlP5OVMxMDGIdfzfvQxzErxwmoDClrZPuwXWICW0Cu+41c7LsMu 32lr5MpQulcqoCBiMdGQFVMN9WZRIrNXfOyZ3h72hHMjTWhjt++a2IKtJKtz729vtRxV oDZoX+UkyRCZ8omfUcyGU5SUppm2StQpKJTCl6qsBhQlEZvElavxPhHrGuOzzbXdpmWV p/6J736nd2hzfl9JzbiI05lmfgCqGVoODQUVpR/G60/h7GFVDq4AERGcI06D3DQt5pHM 3FGg== 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 t79-v6si4805007pfa.170.2018.08.08.07.28.21; Wed, 08 Aug 2018 07:28:35 -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 S1727738AbeHHQq7 (ORCPT + 99 others); Wed, 8 Aug 2018 12:46:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727396AbeHHQq6 (ORCPT ); Wed, 8 Aug 2018 12:46:58 -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 BC151219C9; Wed, 8 Aug 2018 14:27:02 +0000 (UTC) Date: Wed, 8 Aug 2018 10:27:00 -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: <20180808102700.38c4169d@gandalf.local.home> In-Reply-To: <20180808130041.GI24813@linux.vnet.ibm.com> References: <6B9E5DC9-0859-41B4-9B72-A7D85E9EA2AD@google.com> <20180807194515.4e549c1a@gandalf.local.home> <6D0A3FD6-2190-4CC0-A3C0-7B3759E73243@google.com> <20180807204820.50b83c6d@vmware.local.home> <20180807215522.04114097@vmware.local.home> <20180807222856.3ede96e7@vmware.local.home> <20180808130041.GI24813@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 06:00:41 -0700 "Paul E. McKenney" wrote: > > I suppose that an srcu_read_lock_nmi() and srcu_read_unlock_nmi() could > be added, which would do atomic ops on sp->sda->srcu_lock_count. Not sure > whether this would be fast enough to be useful, but easy to provide: > > int __srcu_read_lock_nmi(struct srcu_struct *sp) /* UNTESTED. */ > { > int idx; > > idx = READ_ONCE(sp->srcu_idx) & 0x1; > atomic_inc(&sp->sda->srcu_lock_count[idx]); > smp_mb__after_atomic(); /* B */ /* Avoid leaking critical section. */ > return idx; > } > > void __srcu_read_unlock_nmi(struct srcu_struct *sp, int idx) > { > smp_mb__before_atomic(); /* C */ /* Avoid leaking critical section. */ > atomic_inc(&sp->sda->srcu_unlock_count[idx]); > } > > With appropriate adjustments to also allow Tiny RCU to also work. > > Note that you have to use _nmi() everywhere, not just in NMI handlers. > In fact, the NMI handlers are the one place you -don't- need to use > _nmi(), strangely enough. > > Might be worth a try -- smp_mb__{before,after}_atomic() is a no-op on > some architectures, for example. Note this would kill the performance that srcu gives that Joel wants. Switching from a this_cpu_inc() to a atomic_inc() would be a huge impact. There's also a local_inc() if you are using per cpu pointers, that is suppose to guarantee atomicity for single cpu operations. That's what the ftrace ring buffer uses. -- Steve