Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4774442pxj; Tue, 22 Jun 2021 07:47:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2Ynvr2EmO2lw1+AOu/ad0/r/Aq10LP5ZgVLc5qFse9u4F1ljjF6F4phfyBHLC4vX9P/kj X-Received: by 2002:a05:6402:419:: with SMTP id q25mr5548520edv.331.1624373247547; Tue, 22 Jun 2021 07:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624373247; cv=none; d=google.com; s=arc-20160816; b=p98oRSeNTNvBV4L7LS7THG8woRASAOlJpQe985I8b3Wihg1lYRMWEAu6SMhQhgW79b Oqd0Jnl9GC6IgH0IqeINLLaUN3to5fIjmORHz9wb/QwNJu1ErgTuN6ObFvLl10wovdJa 9hd29IYdxQ4j0wVLPEG4UoqqbN5oKhNsGFfrJMVKa35J2pKpk3kPYi4z9HWns3f4vfTm e9BQ6GIALqASiLoi9m1t3Xo0gZF7XMSdPRSD/8VfUKunGri/WiJugpyu7x9WltKG4tNa ltUoRJuZaadPAeQPAD38N349UxhT7S2Jkv+jcnpwB+PqYAfNJG0SUggCuziT1qZL+7Qd T5ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ixkqrIKMQSntHkRSmfPmSF6qX7bW09wmkdMsRAwdhZk=; b=zrnDKOC6TDS1zatE3MylOmi21utrQ213qTGH1QhuC+SaE5DkQJX0CryD/DSRHcLeo+ 0uB1QTqI5adMIdoG2W4cyFNKCjSYw2ebdkyZn87zbC/8uC6IQEYiwJHTL4lNoHwmnKXn sDuzWIQ5a/DiTPAK/8o96BBmu3oHGyhP1MAlohsszRrwCjx+NdAjT6yt5O9bZR/lvY/5 o2upWC8k9MRagpmT8qctwA20smNufKWHLludjAfd4gfCAhy6fs4DsiOioP1A9tnT7aab co+20CPf4ZixvFko1vxdwwmwOdwcoK0ZKjHhxQo4Q4EI9qmVOr72QJIUZ5MlC/qigFaO FZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DLEXOJuG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si18802180edu.543.2021.06.22.07.47.03; Tue, 22 Jun 2021 07:47:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DLEXOJuG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbhFVOp7 (ORCPT + 99 others); Tue, 22 Jun 2021 10:45:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36170 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbhFVOpr (ORCPT ); Tue, 22 Jun 2021 10:45:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624373009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ixkqrIKMQSntHkRSmfPmSF6qX7bW09wmkdMsRAwdhZk=; b=DLEXOJuGXRpnrfeVlOnut29icCq/YcdbrJhmKb95xirwXYWILcia0RObdqYySA1fQslQpj Nj0Kmh46llrI21GfxyWc7f4KtdF47oXDRHAN71VXNnYGJbUQO9Sv6THiWUl/lAlkNYz+HN dJXHvM38sKtCmqfVSNe4lDDeytZ/ec0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-jBW1m9tePtqOTYwzSfRhkw-1; Tue, 22 Jun 2021 10:43:23 -0400 X-MC-Unique: jBW1m9tePtqOTYwzSfRhkw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35018804144; Tue, 22 Jun 2021 14:43:22 +0000 (UTC) Received: from x1.bristot.me.homenet.telecomitalia.it (unknown [10.10.115.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2B2D5D9CA; Tue, 22 Jun 2021 14:43:17 +0000 (UTC) From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Phil Auld , Sebastian Andrzej Siewior , Kate Carcia , Daniel Bristot de Oliveira , Jonathan Corbet , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexandre Chartre , Clark Willaims , John Kacur , Juri Lelli , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 03/14] trace/hwlat: Switch disable_migrate to mode none Date: Tue, 22 Jun 2021 16:42:21 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When in the round-robin mode, if the tracer detects a change in the hwlatd thread affinity by an external tool, e.g., taskset, the round-robin logic is disabled. The disable_migrate variable currently tracks this. With the addition of the "mode" config and the mode "none," the disable_migrate logic is equivalent to switch to the "none" mode. Hence, instead of using a hidden variable to track this behavior, switch the mode to none, informing the user about this change. Cc: Jonathan Corbet Cc: Steven Rostedt Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Alexandre Chartre Cc: Clark Willaims Cc: John Kacur Cc: Juri Lelli Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Daniel Bristot de Oliveira --- kernel/trace/trace_hwlat.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c index 43a436d85a01..bae74b95cf55 100644 --- a/kernel/trace/trace_hwlat.c +++ b/kernel/trace/trace_hwlat.c @@ -286,7 +286,6 @@ static int get_sample(void) } static struct cpumask save_cpumask; -static bool disable_migrate; static void move_to_next_cpu(void) { @@ -294,15 +293,13 @@ static void move_to_next_cpu(void) struct trace_array *tr = hwlat_trace; int next_cpu; - if (disable_migrate) - return; /* * If for some reason the user modifies the CPU affinity * of this thread, then stop migrating for the duration * of the current test. */ if (!cpumask_equal(current_mask, current->cpus_ptr)) - goto disable; + goto change_mode; get_online_cpus(); cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask); @@ -313,7 +310,7 @@ static void move_to_next_cpu(void) next_cpu = cpumask_first(current_mask); if (next_cpu >= nr_cpu_ids) /* Shouldn't happen! */ - goto disable; + goto change_mode; cpumask_clear(current_mask); cpumask_set_cpu(next_cpu, current_mask); @@ -321,8 +318,9 @@ static void move_to_next_cpu(void) sched_setaffinity(0, current_mask); return; - disable: - disable_migrate = true; + change_mode: + hwlat_data.thread_mode = MODE_NONE; + pr_info(BANNER "cpumask changed while in round-robin mode, switching to mode none\n"); } /* @@ -744,7 +742,6 @@ static int hwlat_tracer_init(struct trace_array *tr) hwlat_trace = tr; - disable_migrate = false; hwlat_data.count = 0; tr->max_latency = 0; save_tracing_thresh = tracing_thresh; -- 2.31.1