Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp871398imm; Wed, 17 Oct 2018 09:31:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV63DUyw1Ezl5ES9laBOK7TuQMTU1LzAd/Ny9Bh2+ljikJV9nuz5RJgv7y8zDxxS7SyWNjawN X-Received: by 2002:a63:6bc2:: with SMTP id g185-v6mr25526556pgc.25.1539793892663; Wed, 17 Oct 2018 09:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539793892; cv=none; d=google.com; s=arc-20160816; b=y6/+syFqXYM15cRtdsn7fodYAYi0QJzoUBRRmifrdohJ0Q9lJ531EN6szzbbrrwruq S//2ZcQ7DSdGfEKk8j0Mtxn9/cktLGfTOg5K237tQMS3/I0bANdlQZ9z7zgZGZ2jjR43 FEnJSyLhTZcQAFLQb/J+MANl4INxUfMrCShvoDntUAbRNGuTOkQeKxfxs975n0AkjwPK DeifCS3/PLL4mB4OCRRy9WPZx89TgNX3bex4vewvJptUq8BL+3EUTxMpkFP9SYGDtIhg bLs+TmQy0D+cYbRgoUyNrauLPFPsL6EQ4ktXC78NZZd42kG/t2el80orL45Cy7SawJ3J nYMQ== 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; bh=VSZCaDVhI2aNXE1sv2BKCY80aboktKZNgQDwEs0QIo4=; b=HGltatwzoMbEEtTXTFm2UP4BRMz5rb++nGhrEwZiGQDOiCwIQaVP/PqEQNychZuwMO ineBmOWsN/5TPMaIM6FHHBR9+TGs3l/Y1I5hzHUc/jfAUtnYVejkaBwX8EMg/ZuaVRbj B8doW3JLnhJwzGDwvLvaXH1c8FhYbppOTnt1Pny5tJxmFcEd22b+idcVUgTuxtLke28Y BnJMC2ktu/xxdJ5H2a5MrTMsJ3dZFf8Lr6CHtgLj3BTTG983AsfX9tjTCboxoynYItFU 5/6xxY15dKbR1jr0K7X+IZmkpy0LSLqddMDdHSflO4nIgsIXvc7qLZvB1iEP6n0yZz8e yFnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="jU6/je9E"; 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 h28-v6si2403031pgb.106.2018.10.17.09.31.16; Wed, 17 Oct 2018 09:31:32 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="jU6/je9E"; 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 S1727788AbeJRA1C (ORCPT + 99 others); Wed, 17 Oct 2018 20:27:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36684 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727435AbeJRA1C (ORCPT ); Wed, 17 Oct 2018 20:27:02 -0400 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=VSZCaDVhI2aNXE1sv2BKCY80aboktKZNgQDwEs0QIo4=; b=jU6/je9EHMDB6GHnglgeVeOlO kEO/nIj/YrOJxOZe+oRhkHtFJiUgqjkT7U0vKql9bhDVCcCFJg1HY4W2dOABY8mFR5j54vjHbzdDI pr+K5q/So8sq1latvlKpBgh0Wdqyez5dk7zMudTXj+iIqTwdHkdNCeS98wA7ekbmjPyBOavdjX3KX a4fKr7g0dWWp6F6Czdi6Cl4AmXfhT+SRGoWHgIs1rhwuIUe8N4GHO3LqaxJzEXYiTkU6lBNTbF2Kw aCWPoqgu35nr97dsiw6ZtUoa3jrj4MNjMBTiFJK6bUApZaqaTsG+nGRX1L/N2ZLKYlOq8wrLdw2jS 6IE+rwIWQ==; 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.90_1 #2 (Red Hat Linux)) id 1gCoiF-00068Q-G6; Wed, 17 Oct 2018 16:30:23 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C7F2220298568; Wed, 17 Oct 2018 18:30:21 +0200 (CEST) Date: Wed, 17 Oct 2018 18:30:21 +0200 From: Peter Zijlstra To: Alexey Budankov Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, songliubraving@fb.com, eranian@google.com, tglx@linutronix.de, mark.rutland@arm.com, megha.dey@intel.com, frederic@kernel.org Subject: Re: [RFC][PATCH] perf: Rewrite core context handling Message-ID: <20181017163021.GP3121@hirez.programming.kicks-ass.net> References: <20181010104559.GO5728@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 17, 2018 at 11:57:49AM +0300, Alexey Budankov wrote: > Hi, > > On 10.10.2018 13:45, Peter Zijlstra wrote: > > > -static bool perf_rotate_context(struct perf_cpu_context *cpuctx) > > +/* > > + * XXX somewhat completely buggered; this is in cpu_pmu_context, but we need > > + * event_pmu_context for rotations. We also need event_pmu_context specific > > + * scheduling routines. ARGH > > + * > > + * - fixed the cpu_pmu_context vs event_pmu_context thingy > > + * (cpu_pmu_context embeds an event_pmu_context) > > + * > > + * - need nr_events/nr_active in epc to do per epc rotation > > + * (done) > > + * > > + * - need cpu and task pmu ctx together... > > + * (cpc->task_epc) > > + */ > > +static bool perf_rotate_context(struct perf_cpu_pmu_context *cpc) > > Since it reduces to single cpu context (and single task context) at all times, > ideally, it would probably be coded as simple as this: > > perf_rotate_context() > { > cpu = this_cpu_ptr(&cpu_context) > for_every_pmu(pmu, cpu) Can't do that, because we have per PMU rotation periods.. > for_every_event_ctx(event_ctx, pmu) > rotate(event_ctx, pmu) > } I'm also not sure I get the rest that follows... you only have to rotate _one_ event per PMU. I'll try and understand the rest of you email later; brain has checked out for the day.