From patchwork Tue Mar 5 15:52:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pu Lehui X-Patchwork-Id: 13582561 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A97A8662F for ; Tue, 5 Mar 2024 15:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709653897; cv=none; b=R3TWRMzUQ4iD5x6qckqp/TFQN5sy+O5Qyx9smWEjIlvygdBV3O71upuwmFgE5/npzHVZy+7kQPLqxVvzjo7hkzqHDyBn2IUz5g5zNsJIgYeZpg1Wjc2bw+HBnpAS4cZGF4ALdQqMR14WH8YyWbWv9r1IUOQOV/twPbZYO/RyYHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709653897; c=relaxed/simple; bh=EMd8D9x6LCJyMVuR6HjE7h11goOGadOV9XpnSjsIMz4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TDpKSTic27nVrm0N/4PQTdBQsQEXLwjrO0vXiFQhBe9iHL4imfp95yG6keBmydu7uG9avSIJNHX195E2B9YZAlqsKqF0BFTq21tmqS+sRxc3wLDbS8RfeUnExo+A9Q+LLNBHJb2BKl8NiFVyN6mDc8n9r6ehaqNMyNtvMs/MClI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Tq0RG6Yktz4f3lfp for ; Tue, 5 Mar 2024 23:51:22 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 691E61A016E for ; Tue, 5 Mar 2024 23:51:30 +0800 (CST) Received: from ultra.huawei.com (unknown [10.90.53.71]) by APP4 (Coremail) with SMTP id gCh0CgAHW22BP+dlaK+BGA--.23259S2; Tue, 05 Mar 2024 23:51:30 +0800 (CST) From: Pu Lehui To: linux-riscv@lists.infradead.org, bpf@vger.kernel.org Cc: Atish Patra , Anup Patel , Palmer Dabbelt , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Pu Lehui , Pu Lehui Subject: [PATCH] drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported Date: Tue, 5 Mar 2024 15:52:23 +0000 Message-Id: <20240305155223.1823287-1-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHW22BP+dlaK+BGA--.23259S2 X-Coremail-Antispam: 1UD129KBjvdXoWruF4UJr47Xr1UWFWDCr18Grg_yoWfGwb_Ca 47WFZrKr98Jas0q3yUAwn5urW5t3sYvas5ZFn2g347Ars7Jwn5u3y2vrW7t34UXF47ZF93 tFs5WryxXrZxKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbwkFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s 1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0 cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8Jw ACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l42xK82IYc2Ij64vIr41l 4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI 8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUbXdbUUUUUU== X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ From: Pu Lehui RISC-V perf does not yet support branch sampling. Two riscv bpf testcases get_branch_snapshot and perf_branches/perf_branches_hw failed due to not disabling such sampling. Signed-off-by: Pu Lehui --- drivers/perf/riscv_pmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/perf/riscv_pmu.c b/drivers/perf/riscv_pmu.c index c78a6fd6c57f..bc42cb95a97c 100644 --- a/drivers/perf/riscv_pmu.c +++ b/drivers/perf/riscv_pmu.c @@ -313,6 +313,10 @@ static int riscv_pmu_event_init(struct perf_event *event) u64 event_config = 0; uint64_t cmask; + /* does not support taken branch sampling */ + if (has_branch_stack(event)) + return -EOPNOTSUPP; + hwc->flags = 0; mapped_event = rvpmu->event_map(event, &event_config); if (mapped_event < 0) {