Received: by 10.223.185.116 with SMTP id b49csp1014565wrg; Fri, 16 Feb 2018 10:50:24 -0800 (PST) X-Google-Smtp-Source: AH8x226b901Rm3gLEEUofHQievB61g+uVJhUpzrhWsepkb5B80rLDlOM51bwm3IQ/nKQmX/6q6Kf X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr2770165pld.72.1518807024463; Fri, 16 Feb 2018 10:50:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518807024; cv=none; d=google.com; s=arc-20160816; b=Qv5PhydGBIDA6W7GtzMo+rsqHz/InU/GRx2Igs6nOfLSstvgY1+NaZSnq/OMcAbp6U ktoDpjVrD6N+yyXWJv6Ty6OujaGHbbqE1KWk9fXTUljbuZdJm+YvWcsFXqQinJeJMh03 ttjDxclnWK/mIOWfbpXcJFuY3MqUx0gu+lyS+rzWIh+KX2c7d3i34oRZQ11X23Fi0HWk BBQma2ICOvt2fz4B55MU3AjOkA4eWLjnPZ2hXkiQL/esA3fjRxYGs7lfsQ2islVxMCsl wElTTrXw1ZSk/S7NHBmQMn1IuznM7S4WAfTLldU9PegqeWmjWS20k/MIbumafi2+iR86 v12w== 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:dkim-signature:arc-authentication-results; bh=XsxeUxcXTlBvzxWuks2gJxkBWRE+tHvHqVueY1xS+Qw=; b=VwWkVbgY1mBFXRDVsCsVqd40iB6uIbu1GJyWMh3bI63vAsKU6pfulGzP9cwnd+0QRD YXTZyMajqNJuQbrcd2V4TixIVPlaAcEWTsCAXIamnwMJYbL0w9Rwu3btvKasx8LstOCb rUlDutecX6bgn8FGjVl8kLiswykEjBy+yeW4I5eMXl/AO65SGU0+ZtYXPYIj/ChRcPwx RvYY+WPKMLkGj/SOLPBUe52IZJ2j7Z1sFC1ponvXrQYJIfVt2shCCQQLr10nRCWxUj0D g8v5xj8ZvKobbACmxPYaI0iFSxg0ck0XQ8LpaMLudAmp8x6u6SrqJ68bmfe23ObzTbjC TqOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=muc1lvFR; 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 h62si1608512pge.13.2018.02.16.10.50.10; Fri, 16 Feb 2018 10:50:24 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=muc1lvFR; 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 S1754090AbeBPIVp (ORCPT + 99 others); Fri, 16 Feb 2018 03:21:45 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:34740 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753977AbeBPIVo (ORCPT ); Fri, 16 Feb 2018 03:21:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XsxeUxcXTlBvzxWuks2gJxkBWRE+tHvHqVueY1xS+Qw=; b=muc1lvFRtsRoiGibGYPWMuBrz GNwHFg/n8EgxVXbnUX2b3Kk7KIT/GztJTUqkQRQGEhr1CIKnS5wRVWgvdBMbYO2BFBRm+OTYA5Wtu likPR69KNopJ7Db3p8bKVY2uWRTpofuwONvhDHOJaQeme8w2bTLYCp0mlcdxi2ZbeHcXrK6zRj8m9 uQAadaC02oASXoOMraR7q5Z2xyJhxLrrvi76BsRqRGFywgNKjEhR6o2D7CMREjuodt7cWjLhzlkHJ NjCaGswLOR950ttk83v+vo3gvrplfQOvD12HvA3GcPDmFgdqIaYYJ2qklRDddLdKCSD12Plld1qDt RDoAMBsmQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1embH3-0001oz-Ic; Fri, 16 Feb 2018 08:21:41 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0280620587C40; Fri, 16 Feb 2018 09:21:39 +0100 (CET) Date: Fri, 16 Feb 2018 09:21:39 +0100 From: Peter Zijlstra To: Raghavendra Rao Ananta Cc: alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, mingo@redhat.com, cme@kernel.org, linux-kernel@vger.kernel.org, psodagud@codeaurora.org, tsoni@codeaurora.org, skannan@codeaurora.org Subject: Re: [PATCH 1/1] perf: Add CPU hotplug support for events Message-ID: <20180216082139.GF25181@hirez.programming.kicks-ass.net> References: <1518735701-7014-1-git-send-email-rananta@codeaurora.org> <1518735701-7014-2-git-send-email-rananta@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518735701-7014-2-git-send-email-rananta@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 15, 2018 at 03:01:41PM -0800, Raghavendra Rao Ananta wrote: > Perf framework doesn't allow prevserving CPU events across > CPU hotplugs. The events are scheduled out as and when the > CPU walks offline. Moreover, the framework also doesn't > allow the clients to create events on an offline CPU. As > a result, the clients have to keep on monitoring the CPU > state until it comes back online. > > Therefore, introducing the perf framework to support creation > and preserving of (CPU) events for offline CPUs. Through > this, the CPU's online state would be transparent to the > client and it not have to worry about monitoring the CPU's > state. Success would be returned to the client even while > creating the event on an offline CPU. If during the lifetime > of the event the CPU walks offline, the event would be > preserved and would continue to count as soon as (and if) the > CPU comes back online. > > Signed-off-by: Raghavendra Rao Ananta > --- > include/linux/perf_event.h | 7 +++ > kernel/events/core.c | 123 +++++++++++++++++++++++++++++++++------------ > 2 files changed, 97 insertions(+), 33 deletions(-) > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index 7546822..bc07f16 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -489,6 +489,7 @@ struct perf_addr_filters_head { > * enum perf_event_state - the states of a event > */ > enum perf_event_state { > + PERF_EVENT_STATE_DORMANT = -5, > PERF_EVENT_STATE_DEAD = -4, > PERF_EVENT_STATE_EXIT = -3, > PERF_EVENT_STATE_ERROR = -2, > @@ -687,6 +688,12 @@ struct perf_event { > #endif > > struct list_head sb_list; > + > + /* Entry into the list that holds the events whose CPUs > + * are offline. These events will be removed from the > + * list and installed once the CPU wakes up. > + */ > + struct list_head dormant_entry; No this is absolutely disguisting. You can simply keep the events in the dead CPU's context. It's really not that hard. Also, you _still_ don't explain why you care about dead CPUs.