From patchwork Wed May 17 21:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13245731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7FFDC77B7A for ; Wed, 17 May 2023 21:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WBoYmOc9/Z+RtZmWzw0MDSo9EAwXHHN1Eh+8bJqbGeQ=; b=KyVlpjgVozx7Ry lcMcu3gUvmM926ML7DjbnQls4qWNsua7DGXxH7mTT5lI+WeuGdSJZPZ0ajzUGSQ9piYf5BffTr+BB UkU4Z6864dZ3VtyBjxbEiaAn36L0gEOYnfQROXX+ep0jQyyewzg4MJ/nbfRkbN8QnJtNayMqQ8AfN ClyCUExMcJwEmmhrX89zNOUhQXRRZMUx21ptBcCmDdgdkQuxB1P3oO57fJxVoJO7mdXKvz+GTrnqI 9fBjNipBL35SIlMHHsu5z1n2uUX/4mY7698pUzLpXQ0jpHEAcHpLj8FduGfpIKyiS4iXljFyBkg4t ANaEn/fQgwu6qnDqW9EA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzOh8-00B6t9-2h; Wed, 17 May 2023 21:28:26 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzOh0-00B6pm-2k for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 21:28:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CECD633F5; Wed, 17 May 2023 21:28:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 625C8C433D2; Wed, 17 May 2023 21:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684358897; bh=nfVm74xujbq3R36R15EKG539tSEZfRayOLRFwZceuT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9elMwfN2TKrASRK6OC3ZpLFJ2YcdNzAZcUEJGMKTJy9eDpSEA3IgLuzXWcWktcwW ErIf+pEXnkL2gf1ZH36PRqj6H6XhyogKU4vCa/7S4t0tWyvd8snxxoj/2KWB2Siyoj WbJLG+K6jVLXvt9NGUp97VLwdWBvIGzw75hW8WYZgR4VZZ1FN+wmEI4I5aByKjBnLI pX61OCIP0zmtx1RuHcDPoklRaQRWR20HgKlRKZAfOEQ+rpwdpRBeqjjT6QtLoqM+Jn sxV1tBxJr8r61IFC4IE2JRukUS+/j2xuqOb4NqnWZuDWEx7uSvFrw0QRbNA2dqnasW 0s/l0zHxXEExg== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Linus Walleij , Arnd Bergmann , Russell King , Nicolas Pitre Subject: [PATCH v2 1/8] ARM: vfp: Record VFP bounces as perf emulation faults Date: Wed, 17 May 2023 23:28:01 +0200 Message-Id: <20230517212808.3895190-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230517212808.3895190-1-ardb@kernel.org> References: <20230517212808.3895190-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1524; i=ardb@kernel.org; h=from:subject; bh=nfVm74xujbq3R36R15EKG539tSEZfRayOLRFwZceuT4=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JISXV7b4N36HygAMLZF9/2fb+yrJ3Pos39+R1nPB0MLt3j nm9WFVURykLgxgHg6yYIovA7L/vdp6eKFXrPEsWZg4rE8gQBi5OAZjIxS2MDCt+L705J+3PxvPZ hos/mao9MYw3+Sd6r01P5davJVu/ztjKyPAwsWqmVtBsv3epzGw7N/6xF11s7+mfVjHZ/fDh0Oy mDG4A X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230517_142818_933984_28E19E5A X-CRM114-Status: GOOD ( 15.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org VFP 'bouncing' occurs when the VFP unit cannot complete the execution of a VFP instruction, either because it is not implemented at all, or because the values of the arguments are out of range for the hardware implementation, and the software needs to step in to complete the operation. To give some insight in how much certain programs rely on this bouncing, record the emulation of a VFP instruction in perf's emulation-faults counter. This can be used like so perf stat -e emulation-faults ./testfloat -all2 and the output will be something like Performance counter stats for './testfloat -all2': 259,277 emulation-faults:u 6.846432176 seconds time elapsed Reviewed-by: Linus Walleij Signed-off-by: Ard Biesheuvel --- arch/arm/vfp/vfpmodule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 349dcb944a937a72..08d5dfcf70796eea 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -313,6 +314,7 @@ static u32 vfp_emulate_instruction(u32 inst, u32 fpscr, struct pt_regs *regs) * emulate it. */ } + perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->ARM_pc); return exceptions & ~VFP_NAN_FLAG; }