Received: by 10.223.185.116 with SMTP id b49csp1986434wrg; Mon, 12 Feb 2018 02:15:02 -0800 (PST) X-Google-Smtp-Source: AH8x225u6pCFT3TexOgzblmefS2TUzPi6hXXaGtHJ33fa78KSIQffWCBeJjJ26eh46zrPZ/hE04x X-Received: by 10.98.157.93 with SMTP id i90mr11262028pfd.58.1518430502694; Mon, 12 Feb 2018 02:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518430502; cv=none; d=google.com; s=arc-20160816; b=uXfhPUsNdlysigxQN4tSwDWKbyGicI40GRMuUmoC5moYUYiiX7+6FuB/uFuwHP8xuJ fXdTfEHcJEAzTmpzCrkiuJSOWbP0t15amgrZSjwcmbFhzbI0W++FntRcu+ocuDCKZqk7 am8fmcP4qjbQ0MUwxCYEVcwt4g5aVtD+naQAbnls411yc4P+iWuXPSMIe2tkSigIVCDD I4+J4sbwVNR6PzE1McZEYJ8JqT5zsGzFAW1/ul0OJRtjPfTtCIanqgnt4xRhLnvvvCga A6J4yA6dnJor/U410uG1X7CSl7fFq+xf00RwXOR8DcAs2o1UnOxceW7sR4MWae6RKvGN OO+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=sEq7jFRWrsS1VNJNwKXs7MXNTCMKAa1SbfvRwOzFIfQ=; b=WSxpRg7fxDDZQQXdT882faQDKORtFf41I6u632Bn7JoKO7bZnfX0CAu9PSha21+W9W mbvtlsEvKGjrzRVbAvcwaWony9zixVZyYw4tz5aethOAbXAMZiF1B1MfXEBWspoz1I3b eFXaMAIlQuTtPAHXx0uW2pQg2njGZEnmg1hzKtpnzf6Sbkh4US1zFx29bZaxGIifcna8 uG8LyWLYUUdPUw4aaPK1DQ8a/kfrlXGT1VnbZvYnhdITAEMvdQVnwtNAbrH+u712Ni9r UpLTO5MVrhqTwnh/UETqP7zwbAHX8fUENIZEX+4MOk6UGK8zpS8PNImgNWaDMcspjiam nNuw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z79si4199145pfi.381.2018.02.12.02.14.47; Mon, 12 Feb 2018 02:15:02 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933358AbeBLJoK (ORCPT + 99 others); Mon, 12 Feb 2018 04:44:10 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58718 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933099AbeBLJoJ (ORCPT ); Mon, 12 Feb 2018 04:44:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7EF8C8011454; Mon, 12 Feb 2018 09:44:08 +0000 (UTC) Received: from krava (unknown [10.43.17.235]) by smtp.corp.redhat.com (Postfix) with SMTP id 377212026DFD; Mon, 12 Feb 2018 09:44:07 +0000 (UTC) Date: Mon, 12 Feb 2018 10:44:06 +0100 From: Jiri Olsa To: Raghavendra Rao Ananta Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, psodagud@codeaurora.org, tsoni@codeaurora.org Subject: Re: [PATCH] perf: Add support for creating offline events Message-ID: <20180212094406.GE5821@krava> References: <1518217620-28458-1-git-send-email-rananta@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518217620-28458-1-git-send-email-rananta@codeaurora.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Feb 2018 09:44:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Feb 2018 09:44:08 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 09, 2018 at 03:07:00PM -0800, Raghavendra Rao Ananta wrote: SNIP > > if (!task) { > +#if defined CONFIG_HOTPLUG_CPU || defined CONFIG_KEXEC_CORE > + struct perf_cpu_context *cpuctx = > + container_of(ctx, struct perf_cpu_context, ctx); > + > + if (!cpuctx->online) { > + perf_prepare_install_in_context(event); > + return; > + } > +#endif > cpu_function_call(cpu, __perf_install_in_context, event); > return; > } > @@ -2421,6 +2443,43 @@ static int __perf_install_in_context(void *info) > raw_spin_unlock_irq(&ctx->lock); > } > > +#if defined CONFIG_HOTPLUG_CPU || defined CONFIG_KEXEC_CORE > +static void perf_deferred_install_in_context(int cpu) > +{ > + struct perf_event *event, *tmp; > + struct perf_event_context *ctx; > + > + /* This function is called twice while coming online. Once for > + * CPUHP_PERF_PREPARE and the other for CPUHP_AP_PERF_ONLINE. > + * Only during the CPUHP_AP_PERF_ONLINE state, we can confirm > + * that CPU PMU is ready and can be installed to. > + */ > + if (!cpu_online(cpu)) > + return; > + > + spin_lock(&dormant_event_list_lock); > + list_for_each_entry_safe(event, tmp, &dormant_event_list, > + dormant_entry) { > + if (cpu != event->cpu) > + continue; I wonder having per cpu lists would be better here, could be quite busy for big number of CPUs jirka