From patchwork Fri Apr 4 23:21:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Mukhin X-Patchwork-Id: 14039026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1FAA0C36010 for ; Fri, 4 Apr 2025 23:22:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.938394.1339246 (Exim 4.92) (envelope-from ) id 1u0qMW-0007HS-3s; Fri, 04 Apr 2025 23:22:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 938394.1339246; Fri, 04 Apr 2025 23:22:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u0qMV-0007HE-V7; Fri, 04 Apr 2025 23:22:11 +0000 Received: by outflank-mailman (input) for mailman id 938394; Fri, 04 Apr 2025 23:22:11 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u0qMT-0007Gp-Q7 for xen-devel@lists.xenproject.org; Fri, 04 Apr 2025 23:22:11 +0000 Received: from mail-24418.protonmail.ch (mail-24418.protonmail.ch [109.224.244.18]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9a9db45a-11ab-11f0-9ffb-bf95429c2676; Sat, 05 Apr 2025 01:21:58 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9a9db45a-11ab-11f0-9ffb-bf95429c2676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=ibpxuwtswncnlmh4zkhiwv5cie.protonmail; t=1743808916; x=1744068116; bh=49Ju++lLuXU44wcNF7eEoQx4Rfpq2a7Ix0334NpiMts=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=N6varBW8+czG+Pf6ypEky0x4sVyrMy4pE+d4Nh5tsQMbgBEtsaVl2jMMNMZTSXcgc gvq7wlurq/Xh4LBb2MoV9SxI5JYk4wfjBrvZnOweYKLc1pvJuiaWiH7bcrxNFcGxcd lCSBJtokjzuRH8IoTBuV0cQjWGKlnoC+AmlPGIGSkXhOnLMsNGDko8mZN5CMkfhjJM 29xPiv/kmZ0paID3svwXQ6UOXmAZX2LNCsOOd3UWBIMEiGzWrhdKCyPd5N7QuCigf1 CTfH7nBEpcfPTFzbXkAZRvDwNioOdX+AdzVrDXKzNYBMUsFzMf3BpBsVQ2Q/unuIRr EMzykx5l+tQiQ== Date: Fri, 04 Apr 2025 23:21:51 +0000 To: xen-devel@lists.xenproject.org From: dmkhn@proton.me Cc: andrew.cooper3@citrix.com, anthony.perard@vates.tech, jbeulich@suse.com, julien@xen.org, michal.orzel@amd.com, roger.pau@citrix.com, sstabellini@kernel.org, dmukhin@ford.com Subject: [PATCH v4] x86/domain: revisit logging in arch_domain_create() Message-ID: <20250404232145.1252544-1-dmukhin@ford.com> Feedback-ID: 123220910:user:proton X-Pm-Message-ID: 9dc92184b58b03b843d7e9e2828c1d6cd23c2ca2 MIME-Version: 1.0 From: Denis Mukhin 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. Signed-off-by: Denis Mukhin --- Changes since v3: - re-formatted log messages - shortened message text where possible --- xen/arch/x86/domain.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 4989600627..0db0567877 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -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: cannot create domain on this CPU due to 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: cannot 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;