Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5531059ybi; Tue, 4 Jun 2019 08:03:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYfOTyyGryuw5epInb4/kxwMESmRF0/EW7jYjz+2FwwnQS/QESHPh0gRWIQI5ZYv2IQDGN X-Received: by 2002:a17:902:7b8d:: with SMTP id w13mr14055227pll.145.1559660608803; Tue, 04 Jun 2019 08:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559660608; cv=none; d=google.com; s=arc-20160816; b=PX6AXuVmaZZRc1Q+/3aCPlPCWylCxtuHeY/sIq2jqWbZGGlfSN2cm8+G4h7P9yrN/S rKXyrKdF3/29yUTz6H2VuAUAd6rZlwKEaJj+5jUQ4MMTmYmyL+skeMR4qBAbH+H0pTlL m2nonWPXKbaP4h+Um8P457qQSbahLzlyrt94/O2yB/eiQ0dWuvErnmrUIfKtG72h69Ze zCDD9cDXVuwMnK1BieOXbJUzvcAQdatcYxM0WLQYwdat/+kE7OGeh8yqlnKzjSJgDksi gg1V0uYPzzB9GU7ND9HzJNboz2m8VyGcEzMUIuku4vMC9dzrHVjv6f9Sagl1lDZdPNlt HYVA== 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=Qrc/V1SxMI1r3RkjT8iarwBbNxHcdX9M9F2mqxXnpMM=; b=ndOk8YjlN5Z8CIS+/Mns9lTKpUjD5svUmPlX9YksV3j5jOal797wpSAyr5YJ1kJyFx e24DoW2yump1xSQn61kZRaJgoqHjgSMoS/H/A7qbSC+jwLvZl11SE1G3XDaBRdBmeyGV 4hv22swSsHi7j2YlrL9cfdei3Ls6nwYFBi97XDLuwatOPCFoZMe0AyV9XpvL4zXLqHsu ak0GcJA+uYP2/lrHQAJfmVB3x3FULP3e9msT7EoHWvk3HwvkKk9LFjDUyR8yn3by23Gl oJkNm32r7+fqbezWyM819reVcsPp2fU3aP7b0Et4+QsbQ7W+uU9mtt1VG2zHrmuhPsNc +pRQ== 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 a2si23324156pgj.54.2019.06.04.08.03.07; Tue, 04 Jun 2019 08:03:28 -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 S1727954AbfFDPBf (ORCPT + 99 others); Tue, 4 Jun 2019 11:01:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:41718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727737AbfFDPBf (ORCPT ); Tue, 4 Jun 2019 11:01:35 -0400 Received: from oasis.local.home (unknown [146.247.46.6]) (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 D372024AE5; Tue, 4 Jun 2019 15:01:31 +0000 (UTC) Date: Tue, 4 Jun 2019 11:01:27 -0400 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: Joel Fernandes , Peter Zijlstra , linux-kernel@vger.kernel.org, williams@redhat.com, daniel@bristot.me, Ingo Molnar , Thomas Gleixner , "Paul E. McKenney" , Matthias Kaehlcke , Frederic Weisbecker , Yangtao Li , Tommaso Cucinotta Subject: Re: [RFC 2/3] preempt_tracer: Disable IRQ while starting/stopping due to a preempt_counter change Message-ID: <20190604110127.60f1a7eb@oasis.local.home> In-Reply-To: <3a17724b-f903-bc18-1a35-84efd3ea90c9@redhat.com> References: <20190529083357.GF2623@hirez.programming.kicks-ass.net> <20190531074729.GA153831@google.com> <3a17724b-f903-bc18-1a35-84efd3ea90c9@redhat.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 Tue, 4 Jun 2019 12:12:36 +0200 Daniel Bristot de Oliveira wrote: > I discussed this with Steve at the Summit on the Summit (the reason why I did > not reply this email earlier is because I was in the conf/traveling), and he > also agrees with peterz, disabling and (mainly) re-enabling IRQs costs too much. > > We need to find another way to resolve this problem (or mitigate the cost).... :-(. > > Ideas? I thought we talked about using flags in the pc to let us know that we are about to trace the preemption off? If an interrupt comes in, we check the flag: irq_enter() preempt_count_add(HARDIRQ_OFFSET) Then we can have something like: preempt_count_add(val) { int pc = preempt_count(); int trace_val = TRACE_FLAG; if (val == HARDIRQ_OFFSET && (pc & TRACE_FLAG)) { __preempt_count_sub(TRACE_FLAG); trace_val |= TRACE_SET; } __preempt_count_add(val + trace_val); if (!pc) trace_preempt_disable(); __preempt_count_sub(trace_val); And in trace_preempt_enable() we have: if ((preempt_count() & TRACE_SET) && in_irq()) return; Thus, we wont call the preempt_enable tracing code if we started it due to an interrupt preempting the process of setting the trace. Note, I'm writing this while extremely tired (still have yet to get more than 4 hours of sleep) so it may still have bugs, but you should get the idea ;-) -- Steve