Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp984273ybn; Wed, 2 Oct 2019 09:07:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXL49tei5elwbwRnPPxCm+bbqWIneNmwAB7I/ANnyT4r+yTXKqok2W+K//qNZnYKeQlJQg X-Received: by 2002:a50:8a9d:: with SMTP id j29mr4696923edj.283.1570032471790; Wed, 02 Oct 2019 09:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570032471; cv=none; d=google.com; s=arc-20160816; b=hsjWIQutBkQWDoPP+Pg1tFfekCpV7HqGIjsWeWtz3u314iqjoKVRKFMkCqE+SSITx9 cnWATh3pCsFhwf8ro3qYjFDTkKDCnMZkBgI+qwjlem218xJbZpzoWtJaYBicFbLL7ZIR NSTtkENUsFijblv19mtWYBZjAQsFFnYSkEDuzI2jqnC/gNVHmgSXV+hjUehOjDHsP52l xrUEZqrtLSvzhChIERusy30vVyOvt/1WYRMdQ2PuYrremGz5RrNI6PXIXuO79bpEkWud tgXpQ/0V0yvrfIoYJT1CQbgv5gk4ZvO+GY7SkXYtk/YcZT2Uiofm+y1lKPb3z9gsGidN i9uA== 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; bh=xZZLcqMeGKTHCeuLDPLRsb8A1Ro+q9gIgyER76PhMCY=; b=ZmaIrmOAaXL1iwjJcRZxyAGY1Wli75eRKJe8AuefP37IViRy+OnsbhpKJqNJKdsrOZ /cQP5cKXhfR7TH43BTqgiTEJF0eI6Say4x7DocFwXKhU2nndkjPzYcludV46HrLsCISs 7WNWqsSDV3tQmP6E4sxpFbPbEBeKzJkbGwo8kKpLSL7ngg2YdBj/9LSn6tuyhsRJvgPH ZFr5WUjxVva3BvPayIAKHqFwMXLLLpl+6Z7xRs/XfwOCDRj+wfcdLchoAm3atNs7IoeD vKoG6Z/uMBlJFImu7/J3Wq5aVSdwtXwpd45ejbZojP2PWwb9HwBpJ2cLfsi5h78RAJXE MfNA== 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 s21si10689753eja.226.2019.10.02.09.07.25; Wed, 02 Oct 2019 09:07:51 -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 S1728442AbfJBPN2 (ORCPT + 99 others); Wed, 2 Oct 2019 11:13:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:60036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728076AbfJBPN1 (ORCPT ); Wed, 2 Oct 2019 11:13:27 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 A7AB121920; Wed, 2 Oct 2019 15:13:26 +0000 (UTC) Date: Wed, 2 Oct 2019 11:13:24 -0400 From: Steven Rostedt To: "Viktor Rosendahl (BMW)" Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Joel Fernandes Subject: Re: [PATCH v7 1/4] ftrace: Implement fs notification for tracing_max_latency Message-ID: <20191002111324.7590bf6d@gandalf.local.home> In-Reply-To: <20190920152219.12920-2-viktor.rosendahl@gmail.com> References: <20190920152219.12920-1-viktor.rosendahl@gmail.com> <20190920152219.12920-2-viktor.rosendahl@gmail.com> X-Mailer: Claws Mail 3.17.3 (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 Fri, 20 Sep 2019 17:22:16 +0200 "Viktor Rosendahl (BMW)" wrote: > This patch implements the feature that the tracing_max_latency file, > e.g. /sys/kernel/debug/tracing/tracing_max_latency will receive > notifications through the fsnotify framework when a new latency is > available. > > One particularly interesting use of this facility is when enabling > threshold tracing, through /sys/kernel/debug/tracing/tracing_thresh, > together with the preempt/irqsoff tracers. This makes it possible to > implement a user space program that can, with equal probability, > obtain traces of latencies that occur immediately after each other in > spite of the fact that the preempt/irqsoff tracers operate in overwrite > mode. > > This facility works with the hwlat, preempt/irqsoff, and wakeup > tracers. > > The tracers may call the latency_fsnotify() from places such as > __schedule() or do_idle(); this makes it impossible to call > queue_work() directly without risking a deadlock. The same would > happen with a softirq, kernel thread or tasklet. For this reason we > use the irq_work mechanism to call queue_work(). Can fsnotify() be called from irq context? If so, why have the work queue at all? Just do the work from the irq_work handler. -- Steve > > This patch creates a new workqueue. The reason for doing this is that > I wanted to use the WQ_UNBOUND and WQ_HIGHPRI flags. My thinking was > that WQ_UNBOUND might help with the latency in some important cases. > > If we use: > > queue_work(system_highpri_wq, &tr->fsnotify_work); > > then the work will (almost) always execute on the same CPU but if we are > unlucky that CPU could be too busy while there could be another CPU in > the system that would be able to process the work soon enough. > > queue_work_on() could be used to queue the work on another CPU but it > seems difficult to select the right CPU. >