x86/domain: revisit logging in arch_domain_create()
PATCH v2 1/1 x86/domain: revisit logging in arch_domain_create()
From: Denis Mukhin <[email protected]>
Use %pd in all logs issued from arch_domain_create().
Also, expand error message in arch_domain_create() under !emulation_flags_ok() case to help debugging.
---
Changes since v1:
- dropped parentheses around "hardware" in the log message
--- xen/arch/x86/domain.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
xen/arch/x86/domain.c +10 -8
@@ -791,13 +791,12 @@ int arch_domain_create(struct domain *d, {if ( !opt_allow_unsafe ) { -printk (XENLOG_G_ERR "Xen does not allow DomU creation on this CPU" -" for security reasons.\n" ); +printk (XENLOG_G_ERR "%pd: Xen does not allow DomU creation on this CPU" +" for security reasons.\n" , d);return -EPERM ; }printk (XENLOG_G_WARNING -"Dom%d may compromise security on this CPU.\n" , - d->domain_id); +"%pd: domain may compromise security on this CPU.\n" , d); } emflags = config->arch.emulation_flags;
@@ -807,16 +806,19 @@ int arch_domain_create(struct domain *d,if ( emflags & ~XEN_X86_EMU_ALL ) { -printk (XENLOG_G_ERR "d%d: Invalid emulation bitmap: %#x\n" , - d->domain_id, emflags); +printk (XENLOG_G_ERR "%pd: Invalid emulation bitmap: %#x\n" , + d, emflags);return -EINVAL ; }if ( !emulation_flags_ok (d, emflags) ) { -printk (XENLOG_G_ERR "d%d: Xen does not allow %s domain creation " +printk (XENLOG_G_ERR "%pd: Xen does not allow %s %sdomain creation " "with the current selection of emulators: %#x\n" , - d->domain_id,is_hvm_domain (d) ?"HVM" :"PV" , emflags); + d, +is_hvm_domain (d) ?"HVM" :"PV" , +is_hardware_domain (d) ?"hardware " :"" , + emflags);return -EOPNOTSUPP ; } d->arch.emulation_flags = emflags;
Signature · 1 line
2.34.1
Quoted 24 lines · On Tuesday, April 1st, 2025 at 2:10 PM, [email protected] <[email protected]> wrote:
From: Denis Mukhin [email protected]
Use %pd in all logs issued from
arch_domain_create().Also, expand error message in
arch_domain_create()under !emulation_flags_ok() case to help debugging.Signed-off-by Denis Mukhin [email protected]---
Changes since v1:
- dropped parentheses around "hardware" in the log message
---xen/arch/x86/domain.c| 18 ++++++++++--------1 file changed, 10 insertions(+), 8 deletions(-)xen/arch/x86/domain.c +0
-0
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 795
Quoted 7 lines
xen/arch/x86/domain.c +2
-2@@ -791,13 +791,12 @@ int arch_domain_create(struct domain *d, {if ( !opt_allow_unsafe ) { -printk (XENLOG_G_ERR "Xen does not allow DomU creation on this CPU" -" for security reasons.\n" ); +printk (XENLOG_G_ERR "%pd: Xen does not allow DomU creation on this CPU" +" for security reasons.\n" , d);
Forgot to remove full stops in the messages.
Sent v3:
https://lore.kernel.org/xen-devel/[email protected]/
Quoted 40 lines
xen/arch/x86/domain.c +0
-0return -EPERM ; }printk(XENLOG_G_WARNING
- "Dom%d may compromise security on this CPU.\n",
-d->domain_id);+ "%pd: domain may compromise security on this CPU.\n", d); }
emflags =
config->arch.emulation_flags;xen/arch/x86/domain.c +7
-4@@ -807,16 +806,19 @@ int arch_domain_create(struct domain *d,if ( emflags & ~XEN_X86_EMU_ALL ) { -printk (XENLOG_G_ERR "d%d: Invalid emulation bitmap: %#x\n" , - d->domain_id, emflags); +printk (XENLOG_G_ERR "%pd: Invalid emulation bitmap: %#x\n" , + d, emflags);return -EINVAL ; }if ( !emulation_flags_ok (d, emflags) ) { -printk (XENLOG_G_ERR "d%d: Xen does not allow %s domain creation " +printk (XENLOG_G_ERR "%pd: Xen does not allow %s %sdomain creation " "with the current selection of emulators: %#x\n" , - d->domain_id,is_hvm_domain (d) ?"HVM" :"PV" , emflags); + d, +is_hvm_domain (d) ?"HVM" :"PV" , +is_hardware_domain (d) ?"hardware " :"" , + emflags);return -EOPNOTSUPP ;}
d->arch.emulation_flags= emflags;--
2.34.1