From patchwork Tue Apr 16 14:22:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 10903207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6A2C1515 for ; Tue, 16 Apr 2019 14:22:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C697A285D2 for ; Tue, 16 Apr 2019 14:22:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA6FC28A6F; Tue, 16 Apr 2019 14:22:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48BB828A56 for ; Tue, 16 Apr 2019 14:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=QuD4188plVrJGPJZZcN1LaLGpZ43INX+uYwBLnXXrU8=; b=Vmd fyWsmOMkQYqnSA2qbwMibapIanLBVhTfYodExAh1xuJM49kU6+zjC8b8z0H3/TsPrVQqX/UtwKnae VECVc25eAJGe7/5+IwRrulLkOWTcu0zsdD8A0CMzRALW5RS4KOeOgMpoWu8zUxy9+F35+SR+IJyq6 enFoxoQLhkZ7mmOy0lb/9ehd5wvYtVoqYTPL9+vZGftrHkQFk0P6Hxab/NjY8l+jil0sCJq98IgIA 327HZRiTcFv4084GbILKhLlUMlawn3AmAOCnAbRicFQqWbgJ538AnVVIKZPXfytsf6YJkP891OrJH WzhW1idVDImigbAdja+vOuqeW0Dmy+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGOz6-00051n-Qu; Tue, 16 Apr 2019 14:22:52 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGOz3-0004zd-6l for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2019 14:22:50 +0000 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 4F75BEBD; Tue, 16 Apr 2019 07:22:45 -0700 (PDT) Received: from e112298-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 556CB3F59C; Tue, 16 Apr 2019 07:22:43 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/4] arm64: Fix save/restore with IRQ priority masking Date: Tue, 16 Apr 2019 15:22:32 +0100 Message-Id: <1555424556-46023-1-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190416_072249_257324_181F3CD3 X-CRM114-Status: GOOD ( 10.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Julien Thierry , marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, rostedt@goodmis.org, james.morse@arm.com, yuzenghui@huawei.com, wanghaibin.wang@huawei.com, liwei391@huawei.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, As reported by Zenghui[1], there are some locations were a save restore of the IRQ flags can end up masking more IRQs than it should. At the very least, this can prevent the GIC driver from acknowledging some IRQs, or prevent IRQs to be signaled to a VHE-host while a guest is running. We introduce some state-based logic on the values of PMR in order to fix things without just adding more hacks. * Patch 1-2 refactor exisint code * Patch 3 is the actual fix * Patch 4 adds some optionally built debug to shout if we break the assumptions made for PMR states where PSR.I is set [1] https://www.spinics.net/lists/arm-kernel/msg716956.html Cheers, Julien --> Julien Thierry (4): arm64: Do not enable IRQs for ct_user_exit arm64: Always trace_hardirq_off when taking an IRQ arm64: Fix incorrect irqflag restore for priority masking arm64: irqflags: Introduce explicit debugging for IRQ priorities arch/arm64/Kconfig | 11 +++++++ arch/arm64/include/asm/arch_gicv3.h | 4 ++- arch/arm64/include/asm/assembler.h | 18 +++++++++++ arch/arm64/include/asm/daifflags.h | 25 ++++++++++++--- arch/arm64/include/asm/irqflags.h | 62 +++++++++++++++++++------------------ arch/arm64/include/asm/kvm_host.h | 4 ++- arch/arm64/include/asm/ptrace.h | 24 ++++++++++++-- arch/arm64/kernel/entry.S | 42 +++++++++++++++---------- arch/arm64/kernel/process.c | 2 +- arch/arm64/kernel/smp.c | 8 +++-- arch/arm64/kvm/hyp/switch.c | 2 +- 11 files changed, 142 insertions(+), 60 deletions(-) --- 1.9.1