From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755977AbbEVAud (ORCPT ); Thu, 21 May 2015 20:50:33 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54546 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755307AbbEVAu3 (ORCPT ); Thu, 21 May 2015 20:50:29 -0400 Message-ID: <555E7D3B.3070804@zytor.com> Date: Thu, 21 May 2015 17:50:03 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andy Lutomirski CC: Andy Lutomirski , X86 ML , "H.J. Lu" , Borislav Petkov , Jan Beulich , Binutils , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] x86: Stop relying on magic jmp behavior for early_idt_handlers References: <5bf75d3abce25ec615048075705f120b331aaf0b.1432253793.git.luto@kernel.org> <555E791D.1000700@zytor.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/21/2015 05:38 PM, Andy Lutomirski wrote: > On Thu, May 21, 2015 at 5:32 PM, H. Peter Anvin wrote: >> On 05/21/2015 05:17 PM, Andy Lutomirski wrote: >>> >>> diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h >>> index 5a9856eb12ba..4bbe0eb24d7e 100644 >>> --- a/arch/x86/include/asm/segment.h >>> +++ b/arch/x86/include/asm/segment.h >>> @@ -231,12 +231,21 @@ >>> #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8) >>> >>> #ifdef __KERNEL__ >>> -#ifndef __ASSEMBLY__ >>> >>> -extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5]; >>> +/* >>> + * early_idt_handlers is an array of entry points. For simplicity, it's >>> + * a real array. We allocate nine bytes for each entry: two one-byte >>> + * push instructions and a five-byte jump in the worst case. >>> + */ >>> +#define EARLY_IDT_HANDLER_STRIDE 9 >>> +#ifndef __ASSEMBLY__ >>> +extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_STRIDE]; >>> #ifdef CONFIG_TRACING >>> # define trace_early_idt_handlers early_idt_handlers >>> #endif >>> +#endif >>> + >>> +#ifndef __ASSEMBLY__ >>> >> >> Please get rid of the unnecessary #ifndef/#endif pair. > > I did it to preserve logical nesting. I didn't want the pile of > early_idt_handlers declarations and comments to have the side affect > of starting an #ifdef block. > > If you still think I should change it, I'll change it. > Please change it. We generally don't do that kind of logical nesting, it is just clutter. -hpa