Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp185540rwb; Thu, 17 Nov 2022 23:14:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Mm0KjAqwK0B7hE6neUnfcR3FYbGT62MnGKDeBDlnV8ceKbU7Oe15yQnzEXINBTX9zzJeL X-Received: by 2002:a05:6402:b81:b0:45c:a651:8849 with SMTP id cf1-20020a0564020b8100b0045ca6518849mr5139592edb.209.1668755659166; Thu, 17 Nov 2022 23:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668755659; cv=none; d=google.com; s=arc-20160816; b=ICZTr0fTX1bqzLpD1gWWeJJjCm1onJUtyajtPAL2rc0KUiDTnelcj0EWoKag8A3H94 eeIT8RsRrYOBd/bobllZQu8j+nFqxECnB5/vAtkNVbeYEepAKOQRyz0Uy6TTqgwL2GfD F8lZQLgqgV3fxMkxAeWyxlv32JGkYKdktodVglcMf6+OmVEJ2bdAj8Twrh/SP53lnxUf jm+3/5q0Zbpd57CD/ylZDn1OjZEqAAY5Ebpr3y5FOi9tqxtP9ES7BOcaNdQ6BZ2rd3oN LLcJgbv1g3vWx1Li8DNI+DZ4a/6H84oWNTwulkVtuZoPDVshO25bYYDSudyzFma7gHfs f50w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=/PfRZXoRcjwaxCGM5fLuCuwwWNwjpcSEfc9cLiKqvUc=; b=YBAhv+TjqmOULyGVJlDG4vEKK7gPCufQb9AaWF1WwNJZcU8aMk+u+W6gNSbe28iuCZ wJeIuAZV+sFK9pZx3atVtEGZwoQY0cwcPf0y7IalKZbWu1tOmCzpqmtXlw3GSrzZCsqD iJootCkjJ9SV1tAM/PL4Djbn+Joc6Ipqnuqme6XkcT++1BKusm3gVji9VmFx0hP6Agyc OdQgMULG+CuuJF8serfk4OtD5Ex/rWGI5+OBIwEgIFmYGmuFyR3kYPhCoQZdLIN+unBK NPBBWK30snWIfIc0ZZZrDekOOXtAYp7J8WkbWG7AuIEATeqTFUhaVyTOauc0BthiUqO+ lc6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he39-20020a1709073da700b00783d5a873dcsi2945151ejc.341.2022.11.17.23.13.56; Thu, 17 Nov 2022 23:14:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241122AbiKRGjT (ORCPT + 91 others); Fri, 18 Nov 2022 01:39:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiKRGjS (ORCPT ); Fri, 18 Nov 2022 01:39:18 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65B505C769; Thu, 17 Nov 2022 22:39:16 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4BF3923A; Thu, 17 Nov 2022 22:39:22 -0800 (PST) Received: from [10.162.41.7] (unknown [10.162.41.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 174033F73B; Thu, 17 Nov 2022 22:39:10 -0800 (PST) Message-ID: <4efc0ae1-564e-dd05-842a-46fb1aeb4ad8@arm.com> Date: Fri, 18 Nov 2022 12:09:07 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH V5 2/7] arm64/perf: Update struct arm_pmu for BRBE Content-Language: en-US To: Suzuki K Poulose , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, peterz@infradead.org, acme@kernel.org, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com Cc: Mark Brown , James Clark , Rob Herring , Marc Zyngier , Ingo Molnar References: <20221107062514.2851047-1-anshuman.khandual@arm.com> <20221107062514.2851047-3-anshuman.khandual@arm.com> <8f6d3424-2650-8e8b-61f7-1431aec4633b@arm.com> From: Anshuman Khandual In-Reply-To: <8f6d3424-2650-8e8b-61f7-1431aec4633b@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/9/22 17:00, Suzuki K Poulose wrote: > On 07/11/2022 06:25, Anshuman Khandual wrote: >> Although BRBE is an armv8 speciifc HW feature, abstracting out its various >> function callbacks at the struct arm_pmu level is preferred, as it cleaner >> , easier to follow and maintain. >> >> Besides some helpers i.e brbe_supported(), brbe_probe() and brbe_reset() >> might not fit seamlessly, when tried to be embedded via existing arm_pmu >> helpers in the armv8 implementation. >> >> Updates the struct arm_pmu to include all required helpers that will drive >> BRBE functionality for a given PMU implementation. These are the following. >> >> - brbe_filter    : Convert perf event filters into BRBE HW filters >> - brbe_probe    : Probe BRBE HW and capture its attributes >> - brbe_enable    : Enable BRBE HW with a given config >> - brbe_disable    : Disable BRBE HW >> - brbe_read    : Read BRBE buffer for captured branch records >> - brbe_reset    : Reset BRBE buffer >> - brbe_supported: Whether BRBE is supported or not >> >> A BRBE driver implementation needs to provide these functionalities. > > Could these not be hidden from the generic arm_pmu and kept in the > arm64 pmu backend  ? It looks like they are quite easy to simply > move these to the corresponding hooks in arm64 pmu. We have had this discussion multiple times in the past [1], but I still believe, keeping BRBE implementation hooks at the PMU level rather than embedding them with other PMU events handling, is a much better logical abstraction. [1] https://lore.kernel.org/all/c3804290-bdb1-d1eb-3526-9b0ce4c8e8b1@arm.com/ -------------------------------------------------------------------------- > > One thing to answer in the commit msg is why we need the hooks here. > Have we concluded that adding BRBE hooks to struct arm_pmu for what is > an armv8 specific feature is the right approach? I don't recall > reaching that conclusion. Although it might be possible to have this implementation embedded in the existing armv8 PMU implementation, I still believe that the BRBE functionalities abstracted out at the arm_pmu level with a separate config option is cleaner, easier to follow and to maintain as well. Besides some helpers i.e brbe_supported(), brbe_probe() and brbe_reset() might not fit seamlessly, when tried to be embedded via existing arm_pmu helpers in the armv8 implementation. Nonetheless if arm_pmu based additional BRBE helpers is absolutely a no go for folks here in general, will explore arm64 based implementation. ---------------------------------------------------------------------------- I am still waiting for maintainer's take on this issue. I will be happy to rework this series to move all these implementation inside arm64 callbacks instead, if that is required or preferred by the maintainers. But according to me, this current abstraction layout is much better. - Anshuman