The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Michael Rubin <mrubin@google.com>,
	David Sharp <dhsharp@google.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Aditya Kali <adityakali@google.com>
Subject: Re: [PATCH 2/2] x86: Change trap definitions to enumerated values
Date: Thu, 28 Apr 2011 19:40:37 -0400	[thread overview]
Message-ID: <1304034037.18763.217.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1303513438-26519-2-git-send-email-vnagarnaik@google.com>

On Fri, 2011-04-22 at 16:03 -0700, Vaibhav Nagarnaik wrote:
> From: Aditya Kali <adityakali@google.com>
> 
> The traps are referred to by their numbers and it can be difficult to
> understand them while reading the code without context. This patch adds
> enumeration of the trap numbers and replaced the numbers to the correct
> enum for x86.

I actually like this patch, as I find floating numbers in code annoying.

> 
> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
> ---


> -DO_ERROR_INFO(0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip)
> -DO_ERROR(4, SIGSEGV, "overflow", overflow)
> -DO_ERROR(5, SIGSEGV, "bounds", bounds)
> -DO_ERROR_INFO(6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip)
> -DO_ERROR(9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
> -DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
> -DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
> +DO_ERROR_INFO(INTR_DIV_BY_ZERO, SIGFPE, "divide error", divide_error,
> +		FPE_INTDIV, regs->ip)
> +DO_ERROR(INTR_OVERFLOW, SIGSEGV, "overflow", overflow)
> +DO_ERROR(INTR_BOUNDS_CHECK, SIGSEGV, "bounds", bounds)
> +DO_ERROR_INFO(INTR_INVALID_OP, SIGILL, "invalid opcode", invalid_op,
> +		ILL_ILLOPN, regs->ip)
> +DO_ERROR(INTR_SEG_OVERRUN, SIGFPE, "coprocessor segment overrun",
> +		coprocessor_segment_overrun)
> +DO_ERROR(INTR_INVALID_TSS, SIGSEGV, "invalid TSS", invalid_TSS)
> +DO_ERROR(INTR_NO_SEG, SIGBUS, "segment not present", segment_not_present)
>  #ifdef CONFIG_X86_32
> -DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
> +DO_ERROR(INTR_STACK_FAULT, SIGBUS, "stack segment", stack_segment)
>  #endif
> -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
> +DO_ERROR_INFO(INTR_ALIGNMENT, SIGBUS, "alignment check", alignment_check,
> +		BUS_ADRALN, 0)

Could you format the above to make it look more tabular and easier to
read.

>  #ifdef CONFIG_X86_32
> @@ -833,10 +844,10 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code)
>  /* Set of traps needed for early debugging. */
>  void __init early_trap_init(void)
>  {
> -	set_intr_gate_ist(1, &debug, DEBUG_STACK);
> +	set_intr_gate_ist(INTR_DEBUG, &debug, DEBUG_STACK);
>  	/* int3 can be called from all */
> -	set_system_intr_gate_ist(3, &int3, DEBUG_STACK);
> -	set_intr_gate(14, &page_fault);
> +	set_system_intr_gate_ist(INTR_BREAKPOINT, &int3, DEBUG_STACK);
> +	set_intr_gate(INTR_PAGE_FAULT, &page_fault);
>  	load_idt(&idt_descr);
>  }
>  
> @@ -852,30 +863,30 @@ void __init trap_init(void)
>  	early_iounmap(p, 4);
>  #endif
>  
> -	set_intr_gate(0, &divide_error);
> -	set_intr_gate_ist(2, &nmi, NMI_STACK);
> +	set_intr_gate(INTR_DIV_BY_ZERO, &divide_error);
> +	set_intr_gate_ist(INTR_NMI, &nmi, NMI_STACK);
>  	/* int4 can be called from all */
> -	set_system_intr_gate(4, &overflow);
> -	set_intr_gate(5, &bounds);
> -	set_intr_gate(6, &invalid_op);
> -	set_intr_gate(7, &device_not_available);
> +	set_system_intr_gate(INTR_OVERFLOW, &overflow);
> +	set_intr_gate(INTR_BOUNDS_CHECK, &bounds);
> +	set_intr_gate(INTR_INVALID_OP, &invalid_op);
> +	set_intr_gate(INTR_NO_DEV, &device_not_available);
>  #ifdef CONFIG_X86_32
> -	set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS);
> +	set_task_gate(INTR_DBL_FAULT, GDT_ENTRY_DOUBLEFAULT_TSS);
>  #else
> -	set_intr_gate_ist(8, &double_fault, DOUBLEFAULT_STACK);
> +	set_intr_gate_ist(INTR_DBL_FAULT, &double_fault, DOUBLEFAULT_STACK);
>  #endif
> -	set_intr_gate(9, &coprocessor_segment_overrun);
> -	set_intr_gate(10, &invalid_TSS);
> -	set_intr_gate(11, &segment_not_present);
> -	set_intr_gate_ist(12, &stack_segment, STACKFAULT_STACK);
> -	set_intr_gate(13, &general_protection);
> -	set_intr_gate(15, &spurious_interrupt_bug);
> -	set_intr_gate(16, &coprocessor_error);
> -	set_intr_gate(17, &alignment_check);
> +	set_intr_gate(INTR_SEG_OVERRUN, &coprocessor_segment_overrun);
> +	set_intr_gate(INTR_INVALID_TSS, &invalid_TSS);
> +	set_intr_gate(INTR_NO_SEG, &segment_not_present);
> +	set_intr_gate_ist(INTR_STACK_FAULT, &stack_segment, STACKFAULT_STACK);
> +	set_intr_gate(INTR_GPF, &general_protection);
> +	set_intr_gate(INTR_SPURIOUS, &spurious_interrupt_bug);
> +	set_intr_gate(INTR_COPROCESSOR, &coprocessor_error);
> +	set_intr_gate(INTR_ALIGNMENT, &alignment_check);
>  #ifdef CONFIG_X86_MCE
> -	set_intr_gate_ist(18, &machine_check, MCE_STACK);
> +	set_intr_gate_ist(INTR_MCE, &machine_check, MCE_STACK);
>  #endif
> -	set_intr_gate(19, &simd_coprocessor_error);
> +	set_intr_gate(INTR_SIMD_COPROCESSOR, &simd_coprocessor_error);

Could you format these too, maybe even ignore the 80 char limit if it
makes it look better.

The numbers were all one or two characters in length and kept the second
argument easy to read. Now with the larger delta in the difference of
characters, it puts a strain on ones eyes.

-- Steve

>  
>  	/* Reserve all the builtin and the syscall vector: */
>  	for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)



  parent reply	other threads:[~2011-04-28 23:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 23:03 [PATCH 1/2] trace: Add trap entry/exit tracepoints Vaibhav Nagarnaik
2011-04-22 23:03 ` [PATCH 2/2] x86: Change trap definitions to enumerated values Vaibhav Nagarnaik
2011-04-28 23:15   ` Vaibhav Nagarnaik
2011-04-28 23:40   ` Steven Rostedt [this message]
2011-04-29  0:38   ` Thomas Gleixner
2011-04-25 23:39 ` [PATCH 1/2] trace: Add trap entry/exit tracepoints Vaibhav Nagarnaik
2011-04-28 23:36   ` Steven Rostedt
2011-04-29  0:33 ` Thomas Gleixner
2011-04-30  0:52   ` Vaibhav Nagarnaik
2011-04-30  0:52 ` [PATCH 1/2] x86: Change trap definitions to enumerated values Vaibhav Nagarnaik
2011-05-03 13:18   ` Don Zickus
2011-05-03 19:00     ` Vaibhav Nagarnaik
2011-05-03 22:41       ` Michael Rubin
2011-05-03 22:54         ` Steven Rostedt
2011-05-03 23:08           ` David Sharp
2011-04-30  0:52 ` [PATCH 2/2] trace: Add trap entry/exit tracepoints Vaibhav Nagarnaik

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=1304034037.18763.217.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=adityakali@google.com \
    --cc=dhsharp@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mrubin@google.com \
    --cc=tglx@linutronix.de \
    --cc=vnagarnaik@google.com \
    --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