Skip to contentSkip to conversation

x86/domain: revisit logging in arch_domain_create()

PATCH In review [email protected] 2 participants 2 messages Apr 8, 2025 – Apr 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v5 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() and reword some of the messages.

Also, expand error message in arch_domain_create() under !emulation_flags_ok() case to help debugging.

---
Changes since v4:
- updated wording in the messages as per v4 review

---
 xen/arch/x86/domain.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
xen/arch/x86/domain.c +14 -9
index 4989600627..60d85a9b3e 100644
@@ -791,13 +791,14 @@ 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: will not create domU 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: may compromise security on this CPU\n",
+               d);
     }
 
     emflags = config->arch.emulation_flags;
@@ -807,16 +808,20 @@ 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 "
-               "with the current selection of emulators: %#x\n",
-               d->domain_id, is_hvm_domain(d) ? "HVM" : "PV", emflags);
+        printk(XENLOG_G_ERR
+               "%pd: will not create %s %sdomain with emulators: %#x\n",
+               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
Acked-by on v5 1/1
#1 lore raw
Quoted 9 lines · On 09.04.2025 00:40, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Use %pd in all logs issued from arch_domain_create() and reword some of the messages.

Also, expand error message in arch_domain_create() under !emulation_flags_ok() case to help debugging.

Somewhat reluctantly:

It still remains unclear to me why you think you need to change aspects of prior wording for no apparent reason. For example, ...

xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 796

Quoted 11 lines
xen/arch/x86/domain.c +3 -2
@@ -791,13 +791,14 @@ 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: will not create domU on this CPU for security reasons\n",
+                   d);

... why would "DomU" need to change to "domU"? Yes, we're inconsistent about the case of the first letter. Yet the change here doesn't help the inconsistency in any way. My more general request remains, going forward:
Please no changes, big or small, that don't have at least a tiny bit of a reason.

Jan