Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2366773ybl; Mon, 20 Jan 2020 01:24:11 -0800 (PST) X-Google-Smtp-Source: APXvYqyWV5d1h6ZkA2kuTim8T2FcjR5HgllK3lHVSzokq2rFNBNN+Y2bq2soaHMsONKe9DVTTtHQ X-Received: by 2002:a9d:7ad9:: with SMTP id m25mr14651187otn.13.1579512251101; Mon, 20 Jan 2020 01:24:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579512251; cv=none; d=google.com; s=arc-20160816; b=pQ0TWZUrvzjIB+EhCywcufnwxT0WC6UfxSFVoT4Hm13e7T+DeLxaBjCDy74GMCMVJW 5GJqL4olbUAQIa6NEPIhR/lZBroFaTC6W4CNL1nQwYePz74fTWRDPSqAE6a9JMgbLxZr I/TXdf42wiN/3Pb8AZKZXS3iTbifSsFAEVg5szW3KTEDgcs5b7xFZWytjZ+rN6uv/tnW Pkh3Mit6zjbsourO9GbElOW0Es4clhTwJtamQ7EcXElXGqcPQWRR8gWXnhPd+fiFjTrD yximk95W367Atg0vOXBR0730KR0qlMk9wuQad3BlVWm4fG7r90sTrToQwEI4FCFAP6iN sOTQ== 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=4uEiMVm/2RivzprYXuYQzMtYidTlX8YQdwZ9M5LzWJ4=; b=FZDWmoGbfT0Cdr3pFvl6JqWawie/dafRT4fUAgLDbvRiTXwJAwCNGiJeEelASz1IkV xX51aMgZ/jCqrap45pXtMBDck3VB1kvtngWou1a4pV/vRgQCo2zySBBTIZEqLCvnLqcr nVv1RCcVdXeDQZUXjSXOGseccU8b+YESi5JxeKDnnwlXp9vXJ9OUX4I7I8ovoUADEvvH hHOLke7lRk1AsIGka2bt666LJwwCpOEl2FXOCQ5EbQMqKmttnCl/gBY/dbB7dsqLb+eH djdQ70x18C7JdpkbkQbyxpTLRC6ksnRmbeKDg8tbnedZ9/mQtm7NoaNQyPTAfCBTfZU6 trDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XSHHxChO; 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 t185si17634042oib.39.2020.01.20.01.23.59; Mon, 20 Jan 2020 01:24:11 -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=XSHHxChO; 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 S1727597AbgATJXL (ORCPT + 99 others); Mon, 20 Jan 2020 04:23:11 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:41274 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727254AbgATJXL (ORCPT ); Mon, 20 Jan 2020 04:23:11 -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=4uEiMVm/2RivzprYXuYQzMtYidTlX8YQdwZ9M5LzWJ4=; b=XSHHxChOVmqtgqoywdk9bNqWL I4EuDnnLiBTMkuhcDZ/9nrRIMupvn9VaQBoObNgj5yAoEuIiRwQUsxTtvr/6TIF/QyIfNrrogywW2 DkePG5DtROgRlLevwB956wgkpcf8Q0SOpdXSggLzBjF0GnprkFVykDJGNnkDqK5LYj5zTpX03c8/4 uj1Mbao42UwkxwlMaN/UxdmoFpYDfb3HSV9E5B3whDka9yetIOkpKcOYVeutQJIx3MZyjxjfGxMPx r9Iwq/zeSwKAPj/svpkg/Ci9jJlx3IZLHvee8RzUlUhhMZPIswiYsKqX/Ir3OwnqHQMWB6G187i9U PcGFdo5sA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1itTGx-0007mM-57; Mon, 20 Jan 2020 09:23:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3BBD4305D3F; Mon, 20 Jan 2020 10:21:21 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1F3FF2041FB24; Mon, 20 Jan 2020 10:23:00 +0100 (CET) Date: Mon, 20 Jan 2020 10:23:00 +0100 From: Peter Zijlstra To: kan.liang@linux.intel.com Cc: eranian@google.com, acme@redhat.com, mingo@kernel.org, mpe@ellerman.id.au, linux-kernel@vger.kernel.org, jolsa@kernel.org, namhyung@kernel.org, vitaly.slobodskoy@intel.com, pavel.gerasimov@intel.com, ak@linux.intel.com Subject: Re: [RESEND PATCH V5 1/2] perf/core: Add new branch sample type for HW index of raw branch records Message-ID: <20200120092300.GK14879@hirez.programming.kicks-ass.net> References: <20200116155757.19624-1-kan.liang@linux.intel.com> <20200116155757.19624-2-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200116155757.19624-2-kan.liang@linux.intel.com> 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 Thu, Jan 16, 2020 at 07:57:56AM -0800, kan.liang@linux.intel.com wrote: > struct perf_branch_stack { > __u64 nr; > + __u64 hw_idx; > struct perf_branch_entry entries[0]; > }; The above and below order doesn't match. > @@ -849,7 +853,11 @@ enum perf_event_type { > * char data[size];}&& PERF_SAMPLE_RAW > * > * { u64 nr; > - * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK > + * { u64 from, to, flags } lbr[nr]; > + * > + * # only available if PERF_SAMPLE_BRANCH_HW_INDEX is set > + * u64 hw_idx; > + * } && PERF_SAMPLE_BRANCH_STACK That wants to be written as: { u64 nr; { u64 from, to, flags; } entries[nr]; { u64 hw_idx; } && PERF_SAMPLE_BRANCH_HW_INDEX } && PERF_SAMPLE_BRANCH_STACK But the big question is; why isn't it: { u64 nr; { u64 hw_idx; } && PERF_SAMPLE_BRANCH_HW_INDEX { u64 from, to, flags; } entries[nr]; } && PERF_SAMPLE_BRANCH_STACK to match the struct perf_branch_stack order. Having that variable sized entry in the middle just seems weird. > * > * { u64 abi; # enum perf_sample_regs_abi > * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER