Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2942474ybl; Mon, 20 Jan 2020 12:26:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxUT8JgQi3hk+ieS7C85+Qh62jev6XE4OZ7sro8a0Hc01xHm3mevIt3s9YWYgOLB8s7Zw9x X-Received: by 2002:aca:b60a:: with SMTP id g10mr458653oif.102.1579551971078; Mon, 20 Jan 2020 12:26:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579551971; cv=none; d=google.com; s=arc-20160816; b=Tm/tiFAmqYLJoDAsW+1Mem3qgBWtwhw+3AZL9sLOeZOEW2oSdLhJee9mdULRKvXO5n 4uC7ey70xVeNfxhHbMw7SwTXluuf4bSzBkTjgHVKU31tzDyr4TpX8Eorp9hJnhPoQgaA 4BN7MMofH+gE7gyK+KT7M1+hrt5N5gyAp4FUual0BsPVG8DeEAlTl02s/7jHdOlDBZAg yut9YIYz0CKGzTtyW+EIIwSDeJtAhhsvpDoZ04sR8FPVwWsolOan4h+kbG8xzxvbmIye 0KyDA5FqB3e+uSJbmwKqPDVfFhqeeqa2iiIFAyn7614FA3YzJJpwBdJT/jYk6ibEbPKt ARZw== 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=4xQh2+mbDMkjK5BgNq7PGZ3p/kueXty4l/MuFAv2eV8=; b=K34zltEy+5Aq8prgd7QNIIlx7/SGEZF3sqBt/Xht0V1/OLyqCj9AQn/KhDjt1iALa4 zDX7Bx4KgfqmICu5eWZuqtnxsuUuybrB70hdN5zrlFeWgXanA39uU3RfE2MdzUYnxBZ4 33gCoGLW7ib9gQeqmgsScP4y7rlVX/PwxwKH33oNruacSdNzUnZWBJ8rM8Oz+yPk3LNt wd/r98Y/l6vCVSraT4tXz+U224mDWbWn22gROOLsLQPamMgaTncVsHqV7MxkY8vrtJlq +rX/4xkNUAbJxB97jfg6zjnmqMb6abWR8Ee9DFTTTq3HnQIVGw+/erlc7ahNK07KxEDC rJ2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=CpCECuDj; 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 i12si21122504otl.74.2020.01.20.12.25.58; Mon, 20 Jan 2020 12:26: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=merlin.20170209 header.b=CpCECuDj; 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 S1726958AbgATUZD (ORCPT + 99 others); Mon, 20 Jan 2020 15:25:03 -0500 Received: from merlin.infradead.org ([205.233.59.134]:37818 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgATUZD (ORCPT ); Mon, 20 Jan 2020 15:25:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=4xQh2+mbDMkjK5BgNq7PGZ3p/kueXty4l/MuFAv2eV8=; b=CpCECuDjgRURMdCawCBjRayvs d1fHV6oxoKtvBVWrhzH4qYf9sd/eiH9dlkavZIJkipG34HEMduhDIJaJika+7rMzIfQjKVi6VpWs0 NRnJnz/b1bYuP75J6RgayXWxjBDnXWdul5R0jeJsKuvTda622VEQvY9W/ilVZU2uhZV46A8yoK6jY ylGv95eTMmuISCQ+4lo8JIe8Lcb1Qok1q4Mc/sSXdX9mWGikApooY50LQhM9wOd9+7jYkbvhUOT4Z 0ewZkclKRKOv3uIVHAkZd0z3rHIdflg+1ROpC2RW+vhV21K/LWUPRgGsGSgAAvK0HKfRGY1G0s6Si s/Bqxsf+w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1itdbM-0002Xt-MZ; Mon, 20 Jan 2020 20:24:48 +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 E618E3008A9; Mon, 20 Jan 2020 21:23:06 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 396D920983FDA; Mon, 20 Jan 2020 21:24:45 +0100 (CET) Date: Mon, 20 Jan 2020 21:24:45 +0100 From: Peter Zijlstra To: "Liang, Kan" 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: <20200120202445.GD14914@hirez.programming.kicks-ass.net> References: <20200116155757.19624-1-kan.liang@linux.intel.com> <20200116155757.19624-2-kan.liang@linux.intel.com> <20200120092300.GK14879@hirez.programming.kicks-ass.net> <88802724-aa70-23bc-b2c8-a7a34aa3dfe5@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <88802724-aa70-23bc-b2c8-a7a34aa3dfe5@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 Mon, Jan 20, 2020 at 11:50:59AM -0500, Liang, Kan wrote: > > > On 1/20/2020 4:23 AM, Peter Zijlstra wrote: > > 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. > > > Usually, new data should be output to the end of a sample. Because.... you want old tools to read new output? > However, the entries[0] is sized entry, so I have to put the hw_idx before entries[0] is only in the C thing, and in C you indeed have to put hw_idx before. > entry. It makes the inconsistency. Sorry for the confusion caused. n/p it's clear now I think.