[vbox-dev] New virtualbox vboxvideo mainline kernel broken in Ubuntu
Michael Thayer
michael.thayer at oracle.com
Thu Oct 12 13:41:52 UTC 2017
Hello,
12.10.2017 14:44, Hans de Goede wrote:
[Discussion of getting at guest log data inside a virtual machine.]
> Adding this code from the vboxguest driver I'm upstreaming:
>
> To some .h file:
>
> /**
> * vboxguest logging functions, these log both to the backdoor and call
> * the equivalent kernel pr_foo function.
> */
> __printf(1, 2) void vbg_info(const char *fmt, ...);
> __printf(1, 2) void vbg_warn(const char *fmt, ...);
> __printf(1, 2) void vbg_err(const char *fmt, ...);
>
> To a .c file:
>
> #define VBG_LOG(name, pr_func) \
> void name(const char *fmt, ...) \
> { \
> unsigned long flags; \
> va_list args; \
> int i, count; \
> \
> va_start(args, fmt); \
> spin_lock_irqsave(&vbg_log_lock, flags); \
> \
> count = vscnprintf(vbg_log_buf, sizeof(vbg_log_buf), fmt, args);\
> for (i = 0; i < count; i++) \
> outb(vbg_log_buf[i], VBG_DEBUG_PORT); \
> \
> pr_func("%s", vbg_log_buf); \
> \
> spin_unlock_irqrestore(&vbg_log_lock, flags); \
> va_end(args); \
> } \
> EXPORT_SYMBOL(name)
>
> VBG_LOG(vbg_info, pr_info);
> VBG_LOG(vbg_warn, pr_warn);
> VBG_LOG(vbg_err, pr_err);
>
> And then calling vbg_info / whatever to log should do the trick.
[...]Actually there is another handy trick there (can't remember now if
it works in non-debug builds of VirtualBox) - the machine debugger,
which can detect the dmesg ring buffer in Linux guests without
address-space randomisation, which often means that you can take a look
at it on a hung guest.
Regards
Michael
--
Michael Thayer | VirtualBox engineer
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt
ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister
der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
More information about the vbox-dev
mailing list