* [PATCH] x86_64: ifdef out struct thread_struct::ip
@ 2009-05-03 23:30 Alexey Dobriyan
2009-05-11 15:09 ` [tip:x86/asm] x86, 64-bit: " tip-bot for Alexey Dobriyan
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2009-05-03 23:30 UTC (permalink / raw)
To: mingo; +Cc: linux-kernel, containers
struct thread_struct::ip isn't used on x86_64, struct pt_regs::ip is used
instead.
kgdb should be reading 0 always, but I can't check it.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
arch/x86/include/asm/processor.h | 2 ++
arch/x86/kernel/kgdb.c | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index a6732ff..a9ba743 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -427,7 +427,9 @@ struct thread_struct {
unsigned short fsindex;
unsigned short gsindex;
#endif
+#ifdef CONFIG_X86_32
unsigned long ip;
+#endif
#ifdef CONFIG_X86_64
unsigned long fs;
#endif
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index eedfaeb..d07706f 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -141,7 +141,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
gdb_regs32[GDB_PS] = *(unsigned long *)(p->thread.sp + 8);
gdb_regs32[GDB_CS] = __KERNEL_CS;
gdb_regs32[GDB_SS] = __KERNEL_DS;
- gdb_regs[GDB_PC] = p->thread.ip;
+ gdb_regs[GDB_PC] = 0;
gdb_regs[GDB_R8] = 0;
gdb_regs[GDB_R9] = 0;
gdb_regs[GDB_R10] = 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:x86/asm] x86, 64-bit: ifdef out struct thread_struct::ip
2009-05-03 23:30 [PATCH] x86_64: ifdef out struct thread_struct::ip Alexey Dobriyan
@ 2009-05-11 15:09 ` tip-bot for Alexey Dobriyan
2009-05-11 16:03 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: tip-bot for Alexey Dobriyan @ 2009-05-11 15:09 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, mingo, adobriyan
Commit-ID: 0c23590f00f85467b318ad0c20c36796a5bd4c60
Gitweb: http://git.kernel.org/tip/0c23590f00f85467b318ad0c20c36796a5bd4c60
Author: Alexey Dobriyan <adobriyan@gmail.com>
AuthorDate: Mon, 4 May 2009 03:30:15 +0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 11 May 2009 16:23:54 +0200
x86, 64-bit: ifdef out struct thread_struct::ip
struct thread_struct::ip isn't used on x86_64, struct pt_regs::ip is used
instead.
kgdb should be reading 0 always, but I can't check it.
[ Impact: (potentially) reduce thread_struct size on 64-bit ]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: containers@lists.linux-foundation.org
LKML-Reference: <20090503233015.GJ16631@x200.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/include/asm/processor.h | 2 ++
arch/x86/kernel/kgdb.c | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index a6732ff..a9ba743 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -427,7 +427,9 @@ struct thread_struct {
unsigned short fsindex;
unsigned short gsindex;
#endif
+#ifdef CONFIG_X86_32
unsigned long ip;
+#endif
#ifdef CONFIG_X86_64
unsigned long fs;
#endif
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index eedfaeb..d07706f 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -141,7 +141,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
gdb_regs32[GDB_PS] = *(unsigned long *)(p->thread.sp + 8);
gdb_regs32[GDB_CS] = __KERNEL_CS;
gdb_regs32[GDB_SS] = __KERNEL_DS;
- gdb_regs[GDB_PC] = p->thread.ip;
+ gdb_regs[GDB_PC] = 0;
gdb_regs[GDB_R8] = 0;
gdb_regs[GDB_R9] = 0;
gdb_regs[GDB_R10] = 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tip:x86/asm] x86, 64-bit: ifdef out struct thread_struct::ip
2009-05-11 15:09 ` [tip:x86/asm] x86, 64-bit: " tip-bot for Alexey Dobriyan
@ 2009-05-11 16:03 ` Christoph Hellwig
2009-05-11 17:22 ` Alexey Dobriyan
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2009-05-11 16:03 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, tglx, adobriyan, mingo; +Cc: linux-tip-commits
On Mon, May 11, 2009 at 03:09:40PM +0000, tip-bot for Alexey Dobriyan wrote:
> +#ifdef CONFIG_X86_32
> unsigned long ip;
> +#endif
> #ifdef CONFIG_X86_64
> unsigned long fs;
> #endif
What happened to the good old concept of #if #else #endif?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tip:x86/asm] x86, 64-bit: ifdef out struct thread_struct::ip
2009-05-11 16:03 ` Christoph Hellwig
@ 2009-05-11 17:22 ` Alexey Dobriyan
2009-05-11 17:25 ` Robert P. J. Day
2009-05-11 19:27 ` Ingo Molnar
0 siblings, 2 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2009-05-11 17:22 UTC (permalink / raw)
To: Christoph Hellwig
Cc: mingo, hpa, linux-kernel, tglx, mingo, linux-tip-commits
On Mon, May 11, 2009 at 8:03 PM, Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, May 11, 2009 at 03:09:40PM +0000, tip-bot for Alexey Dobriyan wrote:
>> +#ifdef CONFIG_X86_32
>> unsigned long ip;
>> +#endif
>> #ifdef CONFIG_X86_64
>> unsigned long fs;
>> #endif
>
> What happened to the good old concept of #if #else #endif?
#else suggests alternative which is not the case.
->ip and ->fs can be in different parts of thread_struct.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tip:x86/asm] x86, 64-bit: ifdef out struct thread_struct::ip
2009-05-11 17:22 ` Alexey Dobriyan
@ 2009-05-11 17:25 ` Robert P. J. Day
2009-05-11 19:27 ` Ingo Molnar
1 sibling, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2009-05-11 17:25 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: Christoph Hellwig, mingo, hpa, linux-kernel, tglx, mingo,
linux-tip-commits
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1610 bytes --]
On Mon, 11 May 2009, Alexey Dobriyan wrote:
> On Mon, May 11, 2009 at 8:03 PM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Mon, May 11, 2009 at 03:09:40PM +0000, tip-bot for Alexey Dobriyan wrote:
> >> +#ifdef CONFIG_X86_32
> >> unsigned long ip;
> >> +#endif
> >> #ifdef CONFIG_X86_64
> >> unsigned long fs;
> >> #endif
> >
> > What happened to the good old concept of #if #else #endif?
>
> #else suggests alternative which is not the case.
> ->ip and ->fs can be in different parts of thread_struct.
the arch/x86/Kconfig file certainly suggests that those are
mutually-exclusive alternatives:
...
# Select 32 or 64 bit
config 64BIT
bool "64-bit kernel" if ARCH = "x86"
default ARCH = "x86_64"
---help---
Say yes to build a 64-bit kernel - formerly known as x86_64
Say no to build a 32-bit kernel - formerly known as i386
config X86_32
def_bool !64BIT
config X86_64
def_bool 64BIT
...
unless there's something weird going on underneath.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Annoying Kernel Pedantry.
Web page: http://crashcourse.ca
Linked In: http://www.linkedin.com/in/rpjday
Twitter: http://twitter.com/rpjday
========================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [tip:x86/asm] x86, 64-bit: ifdef out struct thread_struct::ip
2009-05-11 17:22 ` Alexey Dobriyan
2009-05-11 17:25 ` Robert P. J. Day
@ 2009-05-11 19:27 ` Ingo Molnar
1 sibling, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-05-11 19:27 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: Christoph Hellwig, mingo, hpa, linux-kernel, tglx, linux-tip-commits
* Alexey Dobriyan <adobriyan@gmail.com> wrote:
> On Mon, May 11, 2009 at 8:03 PM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Mon, May 11, 2009 at 03:09:40PM +0000, tip-bot for Alexey Dobriyan wrote:
> >> +#ifdef CONFIG_X86_32
> >> unsigned long ip;
> >> +#endif
> >> #ifdef CONFIG_X86_64
> >> unsigned long fs;
> >> #endif
> >
> > What happened to the good old concept of #if #else #endif?
>
> #else suggests alternative which is not the case.
> ->ip and ->fs can be in different parts of thread_struct.
Yes, it's cleaner to have them separate. #if / #else / #endif would
be shorter by one line, and it would be thicker by a big confusion
factor: "why is fs the alternative on 64-bit of 32-bit's ip??"
They could also move apart later on, if structure packing
constraints call for it.
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-05-11 19:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-03 23:30 [PATCH] x86_64: ifdef out struct thread_struct::ip Alexey Dobriyan
2009-05-11 15:09 ` [tip:x86/asm] x86, 64-bit: " tip-bot for Alexey Dobriyan
2009-05-11 16:03 ` Christoph Hellwig
2009-05-11 17:22 ` Alexey Dobriyan
2009-05-11 17:25 ` Robert P. J. Day
2009-05-11 19:27 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®