Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp834141imm; Wed, 17 Oct 2018 09:01:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV630bnRYVkGUjHTdUH2deFOXgOhK3BlGUDjCEdq2aqUgGWRjNTTllefRbF74DyEYcXtN4X/j X-Received: by 2002:a63:9c3:: with SMTP id 186-v6mr25097263pgj.249.1539792093394; Wed, 17 Oct 2018 09:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539792093; cv=none; d=google.com; s=arc-20160816; b=IiWCjw2t4csGoWwOiKHZkh6ERNkMBQmH99xcWQI3AlFl7lteTvVpJ5H++zCSCFfSUn Wx9vOvezSXmivbjdAEsxA3sEoZ/rrzWpKpko2KBRrDrm6r8y5g0pr+Z5D/9gsgln/WbH hmw9Secu2k1+NBfXWM6uKpCRAn0k95nRrs8h/jGbisHbP4ocgmhoJmnmOZkp18r2/4QP VjMRIGioELsowcNoMvs0o3qMjH3q128LicWX1irYMmXG2XTDrz9GFsID778GiPedVhid F36KAQvoxw7TLZz/PVHHda0O02PEqTD2RiBWrSnP+QAjCjU7ovjKT7ZteyzIWdaV8YrE OjSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=fY+OlVZXvsUEniHxOHHLx0RaR0KF3g9jm1d8pEdlE4c=; b=UKcinzbbkdrbRoISx9yewHMsq5LHb3Lz8uEkzwS/a0ncaG3xdbncdBPyWCQJdKOC6o q+pdH7i7MnvCEUVCRU8SGo70v9P+ImOsqHomb+cOJ0xPfkRMpnBROUAtzpwaLMo5hKOx igZKhY1kuvfzMTQ+jE+aoyMTExi2p9WT/HkrpKwDs0pg4oP8910TJkX2rrGWvaKzy6jk 3so/1dZkGZPjtBW2a4/DAnKxPIYSDaxPi5Su7ShRjLqcpzVTJRiHnkpXnELcxxobk8n2 /iiwXFyzJPmTJOPSgHoRFFnNh/iq4ULhtQrR7ZOQbe3Q+zAsfEojRatXPXrg8V+R+roh mbVQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19-v6si17540629pfq.180.2018.10.17.09.01.17; Wed, 17 Oct 2018 09:01:33 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727953AbeJQXzj (ORCPT + 99 others); Wed, 17 Oct 2018 19:55:39 -0400 Received: from mga17.intel.com ([192.55.52.151]:57465 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXzj (ORCPT ); Wed, 17 Oct 2018 19:55:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2018 08:59:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,393,1534834800"; d="scan'208";a="82213028" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 17 Oct 2018 08:59:04 -0700 Received: from [10.252.7.84] (abudanko-mobl.ccr.corp.intel.com [10.252.7.84]) by linux.intel.com (Postfix) with ESMTP id E52F658012D; Wed, 17 Oct 2018 08:59:00 -0700 (PDT) Subject: Re: [RFC][PATCH] perf: Rewrite core context handling To: Alexander Shishkin , Peter Zijlstra , mingo@kernel.org Cc: linux-kernel@vger.kernel.org, acme@kernel.org, jolsa@redhat.com, songliubraving@fb.com, eranian@google.com, tglx@linutronix.de, mark.rutland@arm.com, megha.dey@intel.com, frederic@kernel.org References: <20181010104559.GO5728@hirez.programming.kicks-ass.net> <871s8o62if.fsf@ashishki-desk.ger.corp.intel.com> From: Alexey Budankov Organization: Intel Corp. Message-ID: <9052ed5a-207f-3be4-6a03-8a23ac358c74@linux.intel.com> Date: Wed, 17 Oct 2018 18:58:59 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <871s8o62if.fsf@ashishki-desk.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On 17.10.2018 18:01, Alexander Shishkin wrote: > Alexey Budankov writes: > >> 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) >> for_every_event_ctx(event_ctx, pmu) >> rotate(event_ctx, pmu) >> } >> >> so rotate(event_ctx, pmu) would operate on common events objects semantics >> and memory layout, and PMU specific code handle SW/HW programming differences. > > Ok, what's event_ctx and how does that simplify things? Currently, rotate_ctx() is called twice from perf_rotate_context() for cpu and task contexts: struct perf_cpu_context { struct perf_event_context ctx; struct perf_event_context *task_ctx; If it would be implemented in a loop that could, probably, reduce complexity of perf_rotate_context(), partly pushing the complexity *down* to SW/HW pmu specific code and perf_rotate_context() would become scalable for any number of contexts. Thanks, Alexey > > Regards, > -- > Alex >