Skip to contentSkip to conversation

RFC: EFER in crash notes

PATCH Andrew Cooper 4 participants 6 messages Sep 25, 2012

lore
Share & tools
lore
#0 lore raw

While this patch is very simple, and I hope without any objection, it is RFC for the reason that our crash ABI is private.

The comments for XEN_ELFNOTE_CRASH_REGS does state that it is architecture specific, and makes no indication about the size or contents of the crash note. However, any code trying to use one of these types of notes has to make an assumption that it if the note desc length is 4*8 bytes long, it is representing CR{0,2-4}.

I guess my question boils down to whether it is acceptable to change a private ABI which is not really so private, or whether we should make a formal public ABI for all of the inards of the crash notes and use that.

I have some upcoming plans to put quite a lot more information into this (or an equivalent) structure for extra analysis of the environment at the point of a crash, so perhaps putting in the proper work to make a public ABI would be the best course of action.

Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com

# HG changeset patch
# Parent d364becfb0835f69e85d273fe2b29035c2d975df

xen/include/asm-x86/elf.h +1 -0
diff -r d364becfb083 xen/include/asm-x86/elf.h
@@ -3,6 +3,7 @@
 
 typedef struct {
     unsigned long cr0, cr2, cr3, cr4;
+    unsigned long efer;
 } crash_xen_core_t;
 
 #include <asm/x86_64/elf.h>
xen/include/asm-x86/x86_64/elf.h +4 -0
diff -r d364becfb083 xen/include/asm-x86/x86_64/elf.h
@@ -1,6 +1,8 @@
 #ifndef __X86_64_ELF_H__
 #define __X86_64_ELF_H__
 
+#include <asm/msr.h>
+
 typedef struct {
     unsigned long r15;
     unsigned long r14;
@@ -75,6 +77,8 @@ static inline void elf_core_save_regs(EL
 
     asm volatile("mov %%cr4, %0" : "=r" (tmp) : );
     xen_core_regs->cr4 = tmp;
+
+    rdmsrl(MSR_EFER, xen_core_regs->efer);
 }
 
 #endif /* __X86_64_ELF_H__ */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 9 lines · Andrew Cooper

While this patch is very simple, and I hope without any objection, it is RFC for the reason that our crash ABI is private.

The comments for XEN_ELFNOTE_CRASH_REGS does state that it is architecture specific, and makes no indication about the size or contents of the crash note. However, any code trying to use one of these types of notes has to make an assumption that it if the note desc length is 4*8 bytes long, it is representing CR{0,2-4}.

Quoted 3 lines

I guess my question boils down to whether it is acceptable to change a private ABI which is not really so private, or whether we should make a formal public ABI for all of the inards of the crash notes and use that.

Is it really private? (or even "not so private"), don't external tools like crash support it?

I suppose the size field in the notes is a sort of rudimentary version field. Remember you can always add a new note type though.

Ian.

#2 lore raw
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Andrew Cooper

While this patch is very simple, and I hope without any objection, it is RFC for the reason that our crash ABI is private.

The comments for XEN_ELFNOTE_CRASH_REGS does state that it is architecture specific, and makes no indication about the size or contents of the crash note. However, any code trying to use one of these types of notes has to make an assumption that it if the note desc length is 4*8 bytes long, it is representing CR{0,2-4}.

Quoted 5 lines
Quoted 3 lines

I guess my question boils down to whether it is acceptable to change a private ABI which is not really so private, or whether we should make a formal public ABI for all of the inards of the crash notes and use that.

Is it really private? (or even "not so private"), don't external tools like crash support it?

This is my point. It is not in xen/public but is used by crash/kdump and similar utilities, effectively making it a public ABI.

include/public/elfnote.h even explicitly refers to include/xen/elfcore.h, which is not public by our definition.

Quoted 3 lines

I suppose the size field in the notes is a sort of rudimentary version field. Remember you can always add a new note type though.

Yes, although looking through my code, I do raise an error if sizeof(note->desc) != sizeof(my structure representing this note), which was put in with the best of intentions, but will break with the this RFC change.

On the other hand, adding a new crash note for every new register will not scale well, as it is per PCU.

I guess the only sensible way to continue is to present a formal public ABI.

Quoted 4 lines

Ian.

Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
#3 lore raw
Quoted 8 lines · Andrew Cooper
Quoted 2 lines

I suppose the size field in the notes is a sort of rudimentary version field. Remember you can always add a new note type though.

Yes, although looking through my code, I do raise an error if sizeof(note->desc) != sizeof(my structure representing this note), which was put in with the best of intentions, but will break with the this RFC change.

Quoted 4 lines

On the other hand, adding a new crash note for every new register will not scale well, as it is per PCU.

I guess the only sensible way to continue is to present a formal public ABI.

That seems a good idea.

-- Keir

#4 lore raw
In reply to Andrew Cooper
Quoted 14 lines · Andrew Cooper
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Andrew Cooper

While this patch is very simple, and I hope without any objection, it is RFC for the reason that our crash ABI is private.

The comments for XEN_ELFNOTE_CRASH_REGS does state that it is architecture specific, and makes no indication about the size or contents of the crash note. However, any code trying to use one of these types of notes has to make an assumption that it if the note desc length is 4*8 bytes long, it is representing CR{0,2-4}.

I guess my question boils down to whether it is acceptable to change a private ABI which is not really so private, or whether we should make a formal public ABI for all of the inards of the crash notes and use that.

Quoted 8 lines
Quoted 2 lines

Is it really private? (or even "not so private"), don't external tools like crash support it?

This is my point. It is not in xen/public but is used by crash/kdump and similar utilities, effectively making it a public ABI.

include/public/elfnote.h even explicitly refers to include/xen/elfcore.h, which is not public by our definition.

Hrm, I think it is public despite its location.

Quoted 5 lines
Quoted 4 lines

I suppose the size field in the notes is a sort of rudimentary version field. Remember you can always add a new note type though.

Quoted 7 lines

Yes, although looking through my code, I do raise an error if sizeof(note->desc) != sizeof(my structure representing this note), which was put in with the best of intentions, but will break with the this RFC change.

On the other hand, adding a new crash note for every new register will not scale well, as it is per PCU.

A new note for every batch of registers is what I was thinking. Or a new note with a more extensible structure.

Quoted 7 lines

I guess the only sensible way to continue is to present a formal public ABI.

Quoted 4 lines

Ian.

#5 lore raw
In reply to Andrew Cooper
Quoted 29 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Andrew Cooper

While this patch is very simple, and I hope without any objection, it is RFC for the reason that our crash ABI is private.

The comments for XEN_ELFNOTE_CRASH_REGS does state that it is architecture specific, and makes no indication about the size or contents of the crash note. However, any code trying to use one of these types of notes has to make an assumption that it if the note desc length is 4*8 bytes long, it is representing CR{0,2-4}.

Quoted 5 lines
Quoted 3 lines

I guess my question boils down to whether it is acceptable to change a private ABI which is not really so private, or whether we should make a formal public ABI for all of the inards of the crash notes and use that.

Is it really private? (or even "not so private"), don't external tools like crash support it?

This is my point. It is not in xen/public but is used by crash/kdump and similar utilities, effectively making it a public ABI.

include/public/elfnote.h even explicitly refers to include/xen/elfcore.h, which is not public by our definition.

Quoted 3 lines

I suppose the size field in the notes is a sort of rudimentary version field. Remember you can always add a new note type though.

Quoted 7 lines

Yes, although looking through my code, I do raise an error if sizeof(note->desc) != sizeof(my structure representing this note), which was put in with the best of intentions, but will break with the this RFC change.

On the other hand, adding a new crash note for every new register will not scale well, as it is per PCU.

You don't need a not per addition - if you add a new note now clearly identifying it as "might grow", then subsequently adding to it shouldn't be a problem.

Adding to an existing one that wasn't considered extensible, as you see with your own example above, is not an option unless you have control over _all_ consumers.

Jan