Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp684589imm; Wed, 29 Aug 2018 09:33:54 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbuoh2Q6InHbsyLlWhQfts20U5C5PfY/7mqeylHTmfvW/HeA8zXAQboNlT/Te/Ry2AiED7p X-Received: by 2002:a63:3741:: with SMTP id g1-v6mr6432878pgn.59.1535560434392; Wed, 29 Aug 2018 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535560434; cv=none; d=google.com; s=arc-20160816; b=LML2QnCeY7GxRVyXPT0qEgRAnqs2IWm58UsH4/KbvPLOhHJunTf4ZGb6d5vta2FPTx mbhUqn+/CBZZuwSaWoIYGJKY0oq1jDHHuFrsOaiFFmesRRv7RT46HlR3BvWeDQwFDfCt fTDfmvQgK3wIpM55dqW9MNQy+6rtBlzo2qHAC0H/zt2h8SB4Bz+IzezhhVqH28T2O9Tk 2EO8oy/kpxwukK2p2Dk34g/AJfnHS2zuUwGOugP+x2UFZpj90Da9W/EL3t81IusYVwAp crqFFBvIBEdkHQd2Twd5E9JOF7SSRoCQPyjUnggRTrLmSCVQxIfzDQte4VyJ6wtYjxHw d30w== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=pgiY85zDus0qAEaJbKpojFrp3xQLP6Z2ie7M4Ro1KSs=; b=lTpeGhv9oUjAO3rw3OldH6zcVlPyzjCLKCzdOKhSSUNEZQCGyQ2WLLnrDh3JG/qZoL vv9wle/AamTJlblITSeGX3dDvg3NA0PCiE7JuHA0KtJA2RAw5AsCv/4K81cNKypWuEw5 axjQ4HPE0HXUCCv0sHMtSMPrXdOULzFzCuu80ln7v3spSwLZJm0eWWNn+YcvjZeDDzPs RbxWGjwuU0YgQzCONV27JnJoqaA2Gx+Nas53ImCj1tuzCL+mFvFC4um+YSxQiy//9KhS Tbu/q1y8J2MnhgbyYx2Qv2XkucrXEywB2bivn6uUWyGtx/ktZv/Bzp6LanUXQLedXBSm LCLg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1-v6si4127336pgj.522.2018.08.29.09.33.38; Wed, 29 Aug 2018 09:33:54 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727860AbeH2U36 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 Aug 2018 16:29:58 -0400 Received: from foss.arm.com ([217.140.101.70]:57872 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727293AbeH2U36 (ORCPT ); Wed, 29 Aug 2018 16:29:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E86B18A; Wed, 29 Aug 2018 09:32:15 -0700 (PDT) Received: from dupont (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9EF83F557; Wed, 29 Aug 2018 09:32:14 -0700 (PDT) Date: Wed, 29 Aug 2018 11:32:14 -0500 From: Kim Phillips To: Robert Walker Cc: Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , , , , Subject: Re: [PATCH v2] perf: Support for Arm A32/T32 instruction sets in CoreSight trace Message-Id: <20180829113214.8eb35081da54214c758434ff@arm.com> In-Reply-To: <8ff74d1f-e211-7423-2ad4-35369444488e@arm.com> References: <1535535863-1818-1-git-send-email-robert.walker@arm.com> <20180829084943.eca3716eb2a2141e5eb8e6ee@arm.com> <8ff74d1f-e211-7423-2ad4-35369444488e@arm.com> Organization: Arm X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 29 Aug 2018 15:34:16 +0100 Robert Walker wrote: > Hi Kim, Hi Robert, > On 29/08/18 14:49, Kim Phillips wrote: > > On Wed, 29 Aug 2018 10:44:23 +0100 > > Robert Walker wrote: > > > >> This patch adds support for generating instruction samples from trace of > >> AArch32 programs using the A32 and T32 instruction sets. > >> > >> T32 has variable 2 or 4 byte instruction size, so the conversion between > >> addresses and instruction counts requires extra information from the trace > >> decoder, requiring version 0.9.1 of OpenCSD. A check for the new struct > >> member has been added to the feature check for OpenCSD. > >> > >> Signed-off-by: Robert Walker > >> --- > > ... > >> +++ b/tools/build/feature/test-libopencsd.c > >> @@ -3,6 +3,13 @@ > >> > >> int main(void) > >> { > >> + /* > >> + * Requires ocsd_generic_trace_elem.num_instr_range introduced in > >> + * OpenCSD 0.9 > > 0.9 != 0.9.1 in the above commit text: which is it? > I'll change it to 0.9.1 if there's another version of the patch (it was > introduced in 0.9, but 0.9.1 has a necessary bug fix) > >> + */ > >> + ocsd_generic_trace_elem elem; > >> + (void)elem.num_instr_range; > >> + > > This breaks building against older versions of OpenCSD, right? > > > >> (void)ocsd_get_version(); > > Why don't we maintain building against older versions of the library, > > and use the version information to make the decision on whether to use > > the new feature being introduced in this patch? > The intention is to fail the feature detection check if the older > version is installed - perf will still compile, but without the > CoreSight trace support. It should still compile, and with CoreSight trace support, just not support for A32/T32 instruction sets. The user shouldn't be denied CoreSight trace support if they don't care for A32/T32 ISA support. > OpenCSD is still in development, so new features like this are being > added and it would add a lot of #ifdef mess to the perf code to continue > to support any machines with the old library version installed - there Even adding #ifdefs, that won't survive taking one perf executable built on one machine and running it on another machine with a different version of the OpenCSD library: it'll break inconspicuously, not gracefully! There needs to be a run-time means of working with older versions of the library. Consider checking the sizeof some of the structs? IIRC, some of the structs sizes changed in the library. See e.g., the 'size' field of perf_event_attr: size The size of the perf_event_attr structure for forward/backward compatibility. Set this using sizeof(struct perf_event_attr) to allow the kernel to see the struct size at the time of compilation. or, likely better, the 'version' and 'compat_version' of the perf_event_mmap_page structure: struct perf_event_mmap_page { __u32 version; /* version number of this structure */ __u32 compat_version; /* lowest version this is compat with */ ... > will only be a handful of machines affected and it's trivial to upgrade > them (the new Debian packages are available).? This is upstream linux, so I don't know how you know only a 'handful' of machines affected, and I wouldn't assume everyone's using Debian. For one, I'd hate to see a single user affected if it isn't necessary, as is in this case - not everyone wants A32/T32 ISA support, and library compatibility needn't be broken. This 'screw compatibility' mentality needs to be dropped *now* if CoreSight support is to have a successful future. Otherwise, I suggest keeping this feature in downstream trees for the 'handful', until the library and perf code are rewritten in a state where they properly interoperate, and do not break each other. > How long would we > continue to support such an older version? What do you mean such an older version? The project's v0.9.0 commit was on 20 June 2018, the one that's usable - v0.9.1 - has a July 27 2018 commit date! One month is *not* *old*! >? I also don't see any > precedent for supporting multiple dependent library versions in perf. That's because perf doesn't have a precedent on depending on libraries that flat-out break their own users compatibility across versions ;) Thanks, Kim