Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3693345pxj; Mon, 21 Jun 2021 04:35:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9LXJ7/ciBLtRyH9FDy+NOElNMPjq4Vv2P8Uw8Z6ab/3i+F9AR4JoDKKmYM+Us+tgRvU2C X-Received: by 2002:a5d:9b0b:: with SMTP id y11mr18180301ion.102.1624275329948; Mon, 21 Jun 2021 04:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624275329; cv=none; d=google.com; s=arc-20160816; b=nVb64rtqjzBQcIIlnFYJbbSd9wv8y56NBwNsoNI0nm8aRBytj5dG6eChTF5BAl30JQ rf7k6KDCSUoXu3ADONr4Sp7C3FLD0k5XUEyHb8CsDc10tJ7r3RBQLwHqNJGyjcYwJCH1 ukL1ItHlAEa4pjiQEuKBRbad/x7EavBv79Z+dMCoBF5EyhDfIMHfHKiV7X2XZBGe5Q2N 8LDrU4rvU0yD5C+DRPXHdstqW4HKiXzlywHZTSaF+UltCtkuIFKmc1FT0nd/sdOQpIHV 3dhHh7gYI4aVU20Y41FR4Yer8g5ObKCh0uigY6vdu4GH2PbZwOXBCodWvI9ERBbMtWve km0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=9TwczRoV9TVoF9ppyrvU2lNC6nAkuKP+unrhoJpPrvc=; b=xZljdwZsMUEzfuJ8kbqfYhDFvL8LqDwRNB1taoe4KTufC4weXhiI1T3uiwzRz3Wzq3 wqW1QOcSTTEXjNzv1XMFwU8DBu5oE5Ndw96MdFH2e94HIQYbcKya7pY93NZldXmt3BFw zkKlllaLr7CBr+m3CQkzTXUvsbT+IkWQDx522SBkLtUYdQy9N10JwOqO6rB6YGNUEPng dAcuDTY8CR2UEGik5FED+ZoBnILsaqdZ5ns1n39cdhp2vHBGXRBqAihC1pM7jXw+r3rl RV2jHI6I0hVdvAeQ6Qe8qLrsnCDkHsegPHYwWyEyXPbIEa368REkbDbXwd8yhLmup9co iOsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DCByh50D; 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 m19si20790903jat.118.2021.06.21.04.35.16; Mon, 21 Jun 2021 04:35:29 -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=DCByh50D; 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 S229617AbhFULhE (ORCPT + 99 others); Mon, 21 Jun 2021 07:37:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22731 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFULhD (ORCPT ); Mon, 21 Jun 2021 07:37:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624275289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TwczRoV9TVoF9ppyrvU2lNC6nAkuKP+unrhoJpPrvc=; b=DCByh50DYIj+B84rP7Ol2yN++K7sxuWEDPxkdHkqppzRVQukMDdO9BBkL1C2+LH1suTId4 DdFZQSZAshw5KTX1Mu7iUaeUTIohnmhAAFTryE+Jx33746jnicQgEHA8TnvEbQs1MRxnmI nKrSjxqYu7IQOxOQs52afavHdLOnm6A= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-JHL6YRMlPKeZNVQ6CoZklg-1; Mon, 21 Jun 2021 07:34:48 -0400 X-MC-Unique: JHL6YRMlPKeZNVQ6CoZklg-1 Received: by mail-ed1-f71.google.com with SMTP id c9-20020a05640227c9b0290394ac48c2e4so2026458ede.11 for ; Mon, 21 Jun 2021 04:34:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9TwczRoV9TVoF9ppyrvU2lNC6nAkuKP+unrhoJpPrvc=; b=bzNCs8qgFrqP82PM1Vb4NhM8zEVMEvX/QYoYrp9rpHrHaFjIRIjEqB1tSm+GWCk0M/ qOoUQuNsSUAsmNsHQVcl59k4E7GkZofCZWg6BavJQ1XXJ8iKFp5sqW9P1rtCxjqROby+ B3ziCFy6xbCjeTS+IK2bq2w7JX2DX4WmWw2uFuEFLLqAdAybqsXus7y93XaH1urL+rdQ vbq7egtzRNpxH9KKaTH9VaKQomRpGx/q2z1lQsn5YM+behNyWlaovgMMCV0laFg26iuT /ldji9+artvt8WY+My5aMBl0rFSfCOvPZsOJxFvPscG+JL2htjCWmo/yDt1hgrcsYR6m x/4Q== X-Gm-Message-State: AOAM5302ZX3lntyEql9UgpWY7iVcTF/IfG0+jggaiV0t0pUzd7RX8Wxz OdyZqbPWN666sc0EZCSzUUWrtCGi8Nc3zJP2rA2SSMdlpnDjr1j7h7K7u5ivZcT6VaZYHTAURl9 OSVq97GQi5zXGK27K5WC/11V5hqtyrCFxF6GLuGqZPqZ4l/KNtgdxCVq0FGdNZbt10Gi8X7nB8P 4= X-Received: by 2002:a50:fb01:: with SMTP id d1mr17865089edq.347.1624275286791; Mon, 21 Jun 2021 04:34:46 -0700 (PDT) X-Received: by 2002:a50:fb01:: with SMTP id d1mr17865052edq.347.1624275286560; Mon, 21 Jun 2021 04:34:46 -0700 (PDT) Received: from x1.bristot.me (host-79-23-205-114.retail.telecomitalia.it. [79.23.205.114]) by smtp.gmail.com with ESMTPSA id u21sm4664524eja.59.2021.06.21.04.34.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 04:34:46 -0700 (PDT) Subject: Re: [PATCH V4 05/12] trace/hwlat: Support hotplug operations To: Steven Rostedt Cc: Phil Auld , Sebastian Andrzej Siewior , Kate Carcia , 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 References: <8899f8a8bec38bc600f7a2c61bc6ca664aa7beeb.1623746916.git.bristot@redhat.com> <20210618124503.388fe4d4@oasis.local.home> <20210618150020.689439d4@oasis.local.home> From: Daniel Bristot de Oliveira Message-ID: Date: Mon, 21 Jun 2021 13:34:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210618150020.689439d4@oasis.local.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/18/21 9:00 PM, Steven Rostedt wrote: > On Fri, 18 Jun 2021 12:45:03 -0400 > Steven Rostedt wrote: > >>> +/* >>> + * hwlat_cpu_init - CPU hotplug online callback function >>> + */ >>> +static int hwlat_cpu_init(unsigned int cpu) >>> +{ >>> + struct trace_array *tr = hwlat_trace; >>> + >> You need to take the trace_types_lock here, between testing the >> hwlat_busy and starting the threads. Otherwise, between the two, the >> hwlat tracer could be turned off while a CPU is coming on line, and >> then you just started a per cpu thread, while the hwlat tracer is not >> enabled. > And of course, because get_online_cpus() is called within > trace_types_lock, doing this check is going to cause a lock inversion. > Yep! I tried to take the trace_type_lock here, and got the lockdep info about this problem. > The only thing I could think of is to wake up a worker thread to do the > work. That is, this just wakes the worker thread, then the worker grabs > the trace_types_lock, iterates through the cpu mask of expect running > threads, and then starts or kills them depending on the hwlat_busy > value. So, it will not wait for the kworker to run? -- Daniel > > -- Steve >