Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2100783ybh; Sun, 8 Mar 2020 22:09:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu3ZEHIBjI4LtGaOzyBnvWlI+eVuD4LBrSzOjDzV1Hsr/5otbR1wVLJbDYvrtgSDdQWJ5MA X-Received: by 2002:a05:6830:1e85:: with SMTP id n5mr11410242otr.113.1583730562748; Sun, 08 Mar 2020 22:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583730562; cv=none; d=google.com; s=arc-20160816; b=kFTiCex0+wuHOEXAcCH/yo1OdR5JAgiuMzwO2gmzPqFhsg7zrJJnfditT868cMJld1 Tpt6ImeUV1xlSTEWqYf4g/FtMxp4Q0LzeS+WS9oo7Y1XbYAvxvONrI0v+fnaj+FBMcMe jAvqCIdhAvpe+iG9itNDbI+/FyFEOdsR1sV9q8NaGhrcOf04WM7cWMp3+ji3ZmEbdGLE /FjIQXeCBwY2jxIJACx3PPu5ab0axxKW+IrQ8w/3kIK/B6rBcyS85kDAG2lqIxoQQE4Z btTjclz1p8SFPBUQk/+rJnkjHo2+3MYXGXinnGD/hpQtcLBhLsb++Uz1c0EWw4k8zlaK xEBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nFl7NgmNLIN8sQCgq3SBAsrmBATnujIqCfwAlf8PKYE=; b=Gt01HchY25EX3Oxumavq/Li7K1SMRkAZoUsBW2ZTIyDWQb5NB+ZU/XMIRVo7e0nii3 thru8hXxRGOz8KkU0t6e5HX5tcWICmtWDraucNi/cRYkO3Lgch3NonHN6oBZuupiqwtS 1XT6mZOvgxwoG8DRdMs3+ie4JLPVmQ3yKIwxRVSJIrw/CTIxQD7BVRACSuLFpgqfaSr4 ma5irgcRSDGDIO8nsjHymHqzzbyGYLuQns0mGSMPcDFFCnDWxVCpYZxZ8o9EXE3zYww8 tHJR+kHH+o+oKdLC6602yesEZaobgmJ3ynJqDDCLW10c1psW3joXZyxayBRzcDmFITf5 7Klg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qPtfIydV; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si3518965oiy.274.2020.03.08.22.09.10; Sun, 08 Mar 2020 22:09:22 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qPtfIydV; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726384AbgCIFIs (ORCPT + 99 others); Mon, 9 Mar 2020 01:08:48 -0400 Received: from mail-il1-f194.google.com ([209.85.166.194]:45334 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbgCIFIr (ORCPT ); Mon, 9 Mar 2020 01:08:47 -0400 Received: by mail-il1-f194.google.com with SMTP id p1so3496066ils.12 for ; Sun, 08 Mar 2020 22:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nFl7NgmNLIN8sQCgq3SBAsrmBATnujIqCfwAlf8PKYE=; b=qPtfIydVgk/wqNHn9NwbDAly+4O+yXDUY3c8bmpD9FU94RbdUWiU15RLKAMG2sTn8K UsJEhr89um0gwKNBjJR0sqk3G9VkSWC1Dr6jPHEFRjeNJgwVifo0RaWzrg9A4nc9FMyz 6YuhvTKJ2tU79qkYnaEcIaVmPi0BJvWgZyorroKfw/pFwALbfyBg83qdsJsOrpG77vjL qcxVkF19srsLMwMrq+2/8c7mjN3S9XaFtEsMeeBi1ku/2eknDOECbyA0qI8Ztpour1yI PTfkq6kV2ggvMI2zVGZnJy5yp9HTYIgLLvnX9tGOwiBZ/OBtnevsWtoFP+X5tqL40y4V kScg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nFl7NgmNLIN8sQCgq3SBAsrmBATnujIqCfwAlf8PKYE=; b=OAQAn4awuTwqfv5tWqWrvtzAETKHjbugbFXGq9K4cfOK6uSmGmme9+BarfldVHtr7y ya25UWRbjpD0JcWOKrofjFVFNEFZrdhGP4GIIkPSDk6cH+fmM4x0EwrElJFo2s96fBub /8a76re8ZxDgj8mzpXooGC+HyQRKdqBR8KZsRZuZtoVPP9hzBK63fnNtdxaTPLcYTdn9 kQnK4FwXhu65QZNh62XQs/qFYXVinSjWUdmRwf9Q67xISBHOiJm3LdgkltHVxNIrgnON VAkUKO4G7jpjzkymbiKEGJEVaCNQShF8iy1IhijydNeGM1ckE1BHS65baGorgUXe7quh Fagg== X-Gm-Message-State: ANhLgQ26J2J2C+H+++ybx9e2EEcX9nTAodbYCo2NR1MtbV005zwPW0eq 7ENdMUL1FN+mtWRTvNkyRBpJo0auwNuZDIjH6w== X-Received: by 2002:a92:dad0:: with SMTP id o16mr1372961ilq.27.1583730526906; Sun, 08 Mar 2020 22:08:46 -0700 (PDT) MIME-Version: 1.0 References: <20200308231410.905396057@linutronix.de> <20200308231718.931465601@linutronix.de> In-Reply-To: <20200308231718.931465601@linutronix.de> From: Brian Gerst Date: Mon, 9 Mar 2020 01:08:35 -0400 Message-ID: Subject: Re: [patch part-III V2 05/23] x86/entry/32: Provide macro to emit IDT entry stubs To: Thomas Gleixner Cc: LKML , "the arch/x86 maintainers" , Steven Rostedt , Juergen Gross , Frederic Weisbecker , Alexandre Chartre 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 On Sun, Mar 8, 2020 at 7:24 PM Thomas Gleixner wrote: > > From: Thomas Gleixner > > 32 and 64 bit have unnecessary different ways to populate the exception > entry code. Provide a idtentry macro which allows to consolidate all of > that. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Alexandre Chartre > > --- > arch/x86/entry/entry_32.S | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > --- a/arch/x86/entry/entry_32.S > +++ b/arch/x86/entry/entry_32.S > @@ -44,6 +44,7 @@ > #include > #include > #include > +#include > #include > > #include "calling.h" > @@ -726,6 +727,47 @@ > > .Lend_\@: > .endm > + > +#ifdef CONFIG_X86_INVD_BUG > +.macro idtentry_push_func vector cfunc > + .if \vector == X86_TRAP_XF > + /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */ > + ALTERNATIVE "pushl $do_general_protection", \ > + "pushl $do_simd_coprocessor_error", \ > + X86_FEATURE_XMM > + .else > + pushl $\cfunc > + .endif > +.endm > +#else > +.macro idtentry_push_func vector cfunc > + pushl $\cfunc > +.endm > +#endif IMHO it would be better to push this to the C code and not make the asm more complicated. Something like: dotraplinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code) { #ifdef CONFIG_X86_INVD_BUG /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */ if (!static_cpu_has(X86_FEATURE_XMM)) { do_general_protection(regs, error_code); return; } #endif RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); math_error(regs, error_code, X86_TRAP_XF); } -- Brian Gerst