public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: Kees Cook <keescook@chromium.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, Andy Lutomirski <luto@mit.edu>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mike Frysinger <vapier@gentoo.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] x86: use enum instead of literals for trap values
Date: Fri, 9 Mar 2012 20:08:42 +0100	[thread overview]
Message-ID: <20120309190842.GC13745@aftab> (raw)
In-Reply-To: <CAGXu5jJaO29hqMfACav9v8yEdHXt-SegozGuc+tigYCF6K57WA@mail.gmail.com>

On Fri, Mar 09, 2012 at 10:54:19AM -0800, Kees Cook wrote:
> On Fri, Mar 9, 2012 at 10:28 AM, Borislav Petkov <bp@amd64.org> wrote:
> > On Fri, Mar 09, 2012 at 10:21:52AM -0800, Kees Cook wrote:
> >> > I have to admit personally to prefer something like X86_XCP_XX where XX
> >> > is the two-letter code that the Intel documentation uses for that trap,
> >> > i.e. #GP, #BR, #MC and so on.
> >>
> >> We need a single person to decide on this bike shed color. :) If the
> >> list of enum names can be agreed on, I'll be happy to do the
> >> search/replace for it.
> >
> > Well,
> >
> > here are my 2¢: I agree with hpa because
> >
> > a) it maps the CPU vendor documentation
> > b) it is nicely short
> 
> How about:
> 
> X86_XCP_DE = 0,         /* 0, Divide-by-zero */
> X86_XCP_DB,             /* 1, Debug */
> X86_XCP_NMI,            /* 2, Non-maskable Interrupt */
> X86_XCP_BP,             /* 3, Breakpoint */
> X86_XCP_OF,             /* 4, Overflow */
> X86_XCP_BR,             /* 5, Bound Range Exceeded */
> X86_XCP_UD,             /* 6, Invalid Opcode */
> X86_XCP_NM,             /* 7, Device Not Available */
> X86_XCP_DF,             /* 8, Double Fault */
> X86_XCP_OLD_MF,         /* 9, Coprocessor Segment Overrun */
> X86_XCP_TS,             /* 10, Invalid TSS */
> X86_XCP_NP,             /* 11, Segment Not Present */
> X86_XCP_SS,             /* 12, Stack-Segment Fault */
> X86_XCP_GP,             /* 13, General Protection Fault  */
> X86_XCP_PF,             /* 14, Page Fault */
> X86_XCP_RES,            /* 15, Reserved */

So is this reserved or are we using it for Spurious IRQs? If we use it,
then 'RES' is a bad name. Maybe we define our own like

X86_VEC_SP

and then do

X86_VEC_IR for IRET

in the manner we assumed for the rest?

> X86_XCP_MF,             /* 16, x87 Floating-Point Exception */
> X86_XCP_AC,             /* 17, Alignment Check */
> X86_XCP_MC,             /* 18, Machine Check */
> X86_XCP_XM,             /* 19, SIMD Floating-Point Exception */

Shouln't this be #XF actually? At least it is so in the AMD docs.

> X86_XCP_IRET = 32,      /* 32, IRET Exception */
> 
> There is a name collision for "MF", there's no mnemonic for NMI,

Well, in the AMD docs we actually do have the '#NMI' mnemonic in use.

> IRET, or the reserved "spurious" interrupt.
>
> Can use "VEC" instead "XCP", as Steven suggests.

Yeah, because those actually are fixed interrupt vectors, as they're
called in the AMD docs. Makes sense.

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

  reply	other threads:[~2012-03-09 19:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09  7:42 [PATCH] x86: use enum instead of literals for trap values Kees Cook
2012-03-09  9:28 ` Ingo Molnar
2012-03-09 16:30   ` Kees Cook
2012-03-09 17:57     ` H. Peter Anvin
2012-03-09 18:21       ` Kees Cook
2012-03-09 18:28         ` Borislav Petkov
2012-03-09 18:52           ` Steven Rostedt
2012-03-09 20:10             ` H. Peter Anvin
2012-03-09 22:13               ` Ingo Molnar
2012-03-09 22:23                 ` H. Peter Anvin
2012-03-10  8:34                 ` Pekka Enberg
2012-03-09 18:54           ` Kees Cook
2012-03-09 19:08             ` Borislav Petkov [this message]
2012-03-09 19:14               ` Steven Rostedt
2012-03-09 19:58               ` Kees Cook
2012-03-09 20:13               ` H. Peter Anvin
2012-03-09 20:21                 ` Steven Rostedt
2012-03-10 10:15                   ` Borislav Petkov
2012-03-10 13:54                     ` Steven Rostedt
2012-03-10 14:27                       ` Borislav Petkov
2012-03-11  7:52     ` Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2013-01-22 22:44 [PATCH] x86: Use " John Kacur
2013-02-01 17:18 ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120309190842.GC13745@aftab \
    --to=bp@amd64.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@mit.edu \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=tglx@linutronix.de \
    --cc=vapier@gentoo.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox