Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1101136ybg; Wed, 23 Oct 2019 10:21:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqysH5wjpeBaYCViThN0AoP90XkGGGBbuc16lsA80pqXZBFPY0Ix6rl1WpLews3vl+jvw+sJ X-Received: by 2002:a17:906:5051:: with SMTP id e17mr33044156ejk.139.1571851277727; Wed, 23 Oct 2019 10:21:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571851277; cv=none; d=google.com; s=arc-20160816; b=CmFMHZNZKYDs06u60aGMF8c6iNeaKwSdPidJe7jsy/zHNLZix55P4OrfXoA7FjJMRp aoVQYyR6fU8BPBadh+GEQVcxuNXvefP+MBzeROOtsZ6RJdcJ4VrG5YUsRq2gFismUhk3 YjeRJDq+GR4LCLcmBIJOqrtLSZmx6CpFEaEFvelUbFjs3VhIS7eocgk4ewoir3Kphojf i2YBVmwmPPAPtBqhayv0KV/MzfGn3BITe7mAMi2W2ZJuE+/P1HVFqkYB5XiN7eKLb/0d 64lFwRnECCJ37jSiNagORSUAp5f84LMR8SxwrJXg8vJOiPKbY8i8fwp6IUnwOTUYfESB v7Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id; bh=syBcabitL40KKJ/rXZUzel/KvWLL5THLR32F8ebs4fQ=; b=tdTGxDDVWHUSLCJIdrijQE7TIX547c3XMjnIjhEfxUSfoCyie+xPRRAWC60wOjVqcO 1ykaQX+i/LODQEqbLKg5UmPW7Bj+far9/yuOpCQ0LoiHmZeJtS7wTwu9oVWCnstpWoNa qACPA5TU4dEpky1bejFjUHqszKeVwxVeIuTeS/4vYWEYDEGMtExBwkCl+E+TtSNgVUL6 mfkFi0JgZDcooEAiaZ9/t8ZXP92RloPllr+lMwQC0LNj/amlO51Ntqd9yo+eIPmArn/L c2iopMDOcMOF5ns99zMvH1yRBRedim/56AHS9FDsGmsYKLBEO4fc2UEyHtZv/rGMuQeK HizQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a60si4780331edf.169.2019.10.23.10.20.53; Wed, 23 Oct 2019 10:21:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391532AbfJWMd0 (ORCPT + 99 others); Wed, 23 Oct 2019 08:33:26 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:49091 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389735AbfJWMbk (ORCPT ); Wed, 23 Oct 2019 08:31:40 -0400 Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1iNFnc-000179-B8; Wed, 23 Oct 2019 14:31:36 +0200 Message-Id: <20191023123117.976831752@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 23 Oct 2019 14:27:09 +0200 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Peter Zijlstra , Andy Lutomirski , Will Deacon , Paolo Bonzini , kvm@vger.kernel.org, linux-arch@vger.kernel.org, Mike Rapoport , Josh Poimboeuf , Miroslav Benes Subject: [patch V2 04/17] x86/entry: Make DEBUG_ENTRY_ASSERT_IRQS_OFF available for 32bit References: <20191023122705.198339581@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the interrupt state verification debug macro to common code and fixup the irqflags and paravirt components so it can be used in 32bit code later. Signed-off-by: Thomas Gleixner --- arch/x86/entry/calling.h | 12 ++++++++++++ arch/x86/entry/entry_64.S | 12 ------------ arch/x86/include/asm/irqflags.h | 8 ++++++-- arch/x86/include/asm/paravirt.h | 9 +++++---- 4 files changed, 23 insertions(+), 18 deletions(-) --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -366,3 +366,15 @@ For 32-bit we have the following convent #else #define GET_CR2_INTO(reg) _ASM_MOV %cr2, reg #endif + +.macro DEBUG_ENTRY_ASSERT_IRQS_OFF +#ifdef CONFIG_DEBUG_ENTRY + push %_ASM_AX + SAVE_FLAGS(CLBR_EAX) + test $X86_EFLAGS_IF, %_ASM_AX + jz .Lokay_\@ + ud2 +.Lokay_\@: + pop %_ASM_AX +#endif +.endm --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -387,18 +387,6 @@ ENTRY(spurious_entries_start) .endr END(spurious_entries_start) -.macro DEBUG_ENTRY_ASSERT_IRQS_OFF -#ifdef CONFIG_DEBUG_ENTRY - pushq %rax - SAVE_FLAGS(CLBR_RAX) - testl $X86_EFLAGS_IF, %eax - jz .Lokay_\@ - ud2 -.Lokay_\@: - popq %rax -#endif -.endm - /* * Enters the IRQ stack if we're not already using it. NMI-safe. Clobbers * flags and puts old RSP into old_rsp, and leaves all other GPRs alone. --- a/arch/x86/include/asm/irqflags.h +++ b/arch/x86/include/asm/irqflags.h @@ -126,11 +126,15 @@ static inline notrace unsigned long arch #define ENABLE_INTERRUPTS(x) sti #define DISABLE_INTERRUPTS(x) cli -#ifdef CONFIG_X86_64 #ifdef CONFIG_DEBUG_ENTRY -#define SAVE_FLAGS(x) pushfq; popq %rax +# ifdef CONFIG_X86_64 +# define SAVE_FLAGS(x) pushfq; popq %rax +# else +# define SAVE_FLAGS(x) pushfl; popl %eax +# endif #endif +#ifdef CONFIG_X86_64 #define SWAPGS swapgs /* * Currently paravirt can't handle swapgs nicely when we --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -904,6 +904,11 @@ extern void default_banner(void); ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);) +#endif /* CONFIG_PARAVIRT_XXL */ +#endif /* CONFIG_X86_64 */ + +#ifdef CONFIG_PARAVIRT_XXL + #ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS(clobbers) \ PARA_SITE(PARA_PATCH(PV_IRQ_save_fl), \ @@ -912,10 +917,6 @@ extern void default_banner(void); call PARA_INDIRECT(pv_ops+PV_IRQ_save_fl); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) #endif -#endif /* CONFIG_PARAVIRT_XXL */ -#endif /* CONFIG_X86_64 */ - -#ifdef CONFIG_PARAVIRT_XXL #define GET_CR2_INTO_AX \ PARA_SITE(PARA_PATCH(PV_MMU_read_cr2), \