From patchwork Tue Mar 14 19:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13174971 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 18514C6FD1F for ; Tue, 14 Mar 2023 19:29:00 +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: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:In-Reply-To:References: List-Owner; bh=v8vmrNfwO1vBnc2fP33tjtJHV4IXup9GXP2ZYjqyl6k=; b=hXFqO4CBnKu5M7 izMgwHZHgnJqzb/PFjH5lZfiFjSzE0b46ga54t5ItiF+XZY/2D0LGOUXg9T6P+IpycjtcGD/C/jqi ZE2ZYqq0godW7Io6IPvC6dpA/H2km9VQNMZ+RytSxqCelsvU4NYfUI4WpwjK43u7U5Hae5PrTjJen rtuYVcfGDWoifV1v9JYUja2Y4bU3xbHJbj8B6fB1NujwbQZgHJyhoQhmjWdGktXBD50R8kjkXpNOv T43lqL4+Li2f68kaTQChttDIqpSN0LfKnvuX5lKFEArBb92tAUSNsdrXEZzax8xZ2SIYPydwkRJxC YU5EWbTzW9AvJ8moVxeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcAJi-00BKWa-1L; Tue, 14 Mar 2023 19:28:14 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcAJa-00BKTu-2R for linux-arm-kernel@lists.infradead.org; Tue, 14 Mar 2023 19:28:08 +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 ams.source.kernel.org (Postfix) with ESMTPS id 64CDAB81ACD; Tue, 14 Mar 2023 19:28:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98892C433EF; Tue, 14 Mar 2023 19:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678822084; bh=iwvuFlLMeQaG1J6ewoBbtnldzNR4Z0o64gG/XS6s+v0=; h=From:To:Cc:Subject:Date:From; b=LbEVJOvQpeugKpBvP3oMX2BcilCnqOmNLpuxsNv82J8PkKxyF041b92I38LTVYOTA oaUb3e5kPLnIqnyA4ulSbdArkFT5kVMBEVRuvayP+z8ZQDo6TQ/oh0kjQRaryczjwu rPC5lzfSWt1AXAIGAFyG6F+cR2v/KR8UljhDZ9qmUmhits6dsDhg8ARROza7HRcIME u5FrvAEyfNB6XC5RYCVdkWAEHNVaoK05mzzH27SxTmDBhytFIIasoV6b74nDt28E/h Oy+JeS9dRvszvulT/L/SzpjqdeIh7Tik6kOZObeM2u4guM4x8kcVEDAeeHc7eAGzLk VMwZhtTCgTJpg== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Frederic Weisbecker , Guenter Roeck , Peter Zijlstra , Linus Walleij Subject: [PATCH v2 0/3] ARM: vfp: Switch to C API to en/disable softirqs Date: Tue, 14 Mar 2023 20:27:53 +0100 Message-Id: <20230314192756.217966-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1440; i=ardb@kernel.org; h=from:subject; bh=iwvuFlLMeQaG1J6ewoBbtnldzNR4Z0o64gG/XS6s+v0=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUXg1OZCDvXP+53epygdveJxO+B4/P1Dlve/1T+cvWZqy KIzHYWVHaUsDGIcDLJiiiwCs/++23l6olSt8yxZmDmsTCBDGLg4BWAiKmIM/8ullrips3aVPPjm mTT99K6FEs6iDxfNXjL54s49EyfxP3zI8D/jnrf+tT2tgZ4b7qdn3XTfoXtDYO3vqbfObVnl43C DYRI3AA== 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-20230314_122806_936563_904BD2BC X-CRM114-Status: GOOD ( 12.82 ) 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 As it turns out, enabling or disabling softirqs from asm code is more tricky than it looks. Simply bumping the associated bit in preempt_count does the trick for uninstrumented kernels, but with lockdep or preempt debug enabled, we really need to call the C versions, as replicating their behavior in asm fully is intractible. So let's rework the existing code a little bit so we can interpose a little C helper 'vfp_entry()' that disables softirqs before calling the existing vfpstate handling code in asm. Re-enabling softirqs from asm code is more straight-forward, as we can simply perform a tail call via a C routine that is guaranteed to be callable as a function. Cc: Frederic Weisbecker Cc: Guenter Roeck Cc: Peter Zijlstra Cc: Linus Walleij Link: https://lore.kernel.org/all/ZBBYCSZUJOWBg1s8@localhost.localdomain/ Ard Biesheuvel (3): ARM: vfp: Pass thread_info pointer to vfp_support_entry ARM: vfp: Pass successful return address via register R3 ARM: vfp: Fix broken softirq handling with instrumentation enabled arch/arm/include/asm/assembler.h | 13 --------- arch/arm/vfp/entry.S | 17 ++--------- arch/arm/vfp/vfphw.S | 30 +++++++++++--------- arch/arm/vfp/vfpmodule.c | 27 ++++++++++++++---- 4 files changed, 42 insertions(+), 45 deletions(-) Tested-by: Guenter Roeck