From nobody Fri May 17 06:07:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1584121714; cv=none; d=zohomail.com; s=zohoarc; b=J4VRW99G3q6I8Ax5CKpmKfVCAAJEP57gOaJcI3//bdJ4GGJ0BZ9FBx2+mdnHRfBARnMkjrnzlftAI90bpgU5Ct5kDJNKfTR0pT9V/6qGZIjV0IE00lWkVahhSCzrgWHaupuWowAGkhIAJhyjitBZDbjG8w8MZhsLteKWx58SgKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584121714; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wxNULZcjBctxqpMU4XBmFse30ZAHFCEqK6VoFvBsSgM=; b=DEJVqPm2UaUAt98+P/2CvkFZopxfyGrlSl6epyeW55GsBR2KwaiTopFJTO8Sk6lrxYlopjTqFImKrazUvirA/uYLSl2iYbCXk/4GCBG4a3yMCDYOzzGgLrl7pzuC88eBzjfKzVyUK2Kmb1C44mT18y70Llvki3FJs/q3gw48YVs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15841217146531005.5100112147375; Fri, 13 Mar 2020 10:48:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-qK4uSQWINVSPCmgrDTWuRg-1; Fri, 13 Mar 2020 13:48:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 465BE18FF660; Fri, 13 Mar 2020 17:48:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAC3892D4B; Fri, 13 Mar 2020 17:48:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E98558449D; Fri, 13 Mar 2020 17:48:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02DHmKWl013291 for ; Fri, 13 Mar 2020 13:48:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6B1BD2063FEA; Fri, 13 Mar 2020 17:48:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 664EA2063FE5 for ; Fri, 13 Mar 2020 17:48:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6E9F6101A55D for ; Fri, 13 Mar 2020 17:48:18 +0000 (UTC) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-SDwpyu49Pba4W3UwJbncGg-1; Fri, 13 Mar 2020 13:48:15 -0400 Received: by mail-qk1-f181.google.com with SMTP id e11so13933548qkg.9; Fri, 13 Mar 2020 10:48:15 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:acda:e3b3:e49e:9034:e20d]) by smtp.gmail.com with ESMTPSA id d201sm9301053qke.59.2020.03.13.10.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 10:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584121713; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wxNULZcjBctxqpMU4XBmFse30ZAHFCEqK6VoFvBsSgM=; b=cVQLS8AhuWPqx2JIAO2yUEkwQ4zFjY1/O9zX14+hkJHwwMo97lyOXEzkelncofW4qvUpO9 GgbPljGPJwxyu3yTHIzrxMnynSgof15TEkLBP/Nq6P5Dy8O/ba5+ud8DGwAHrVXEVbOOJs 5a2N1JC0y2KanFWlPYfPGxb2pYsTZQc= X-MC-Unique: qK4uSQWINVSPCmgrDTWuRg-1 X-MC-Unique: SDwpyu49Pba4W3UwJbncGg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lEvw3giRSLjgs4SUU3mQrcJcVGxOl6gjPphkkfNKwjE=; b=BNyEmAPJNRkY5jmSWGtpE212tee4s9th9vTOs55bJlm6Td+2XluU/HmANXVeuh5kLr 6MlhZgO/LAVqi84m+7u/StB96RTanRRecHJSlR9oa0jEPCPr7FBVnh7uXnakC/ZrZNGw YhUqikDg5dsho7mCW6/CEm9CB2Z6Z/S0jwMSrDKivAseLMaQNeMHNXcE7JdI9AxxGbym QaS9aSQBFSHZSzuh/ZpCBrp+xrY6jCIZGA9GtZoav+dP00pcM/iLMIRsoIoFoNo76L3B WqJQFm4gPRQ860P18QuD04TTRfs6+MohHRrJ6L/CDqesnc8omwGoavefh2Fn+UxqoGhs L/4w== X-Gm-Message-State: ANhLgQ0U0zSpJZRHwykFM9zcJNvYAQRobtKRyOESWMhQ8PMWrHvnIWKS 92Sd+VKgk0DKnI5vlOGDlxojrPJz X-Google-Smtp-Source: ADFU+vt4HyUiBKk/IVGAHYyF/DT72u8r8CAx+rH3X18H+gjphlohOcc0BwVhg3+Wjnpf/b7m1/JTlA== X-Received: by 2002:a37:9047:: with SMTP id s68mr14612233qkd.63.1584121694992; Fri, 13 Mar 2020 10:48:14 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 1/1] virt-host-validate: warn if kvm_hv is not loaded for POWER hosts Date: Fri, 13 Mar 2020 14:48:03 -0300 Message-Id: <20200313174803.843442-2-danielhb413@gmail.com> In-Reply-To: <20200313174803.843442-1-danielhb413@gmail.com> References: <20200313174803.843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02DHmKWl013291 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , abologna@redhat.com, crobinso@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" POWER hosts does not implement CPU virtualization extensions like x86 or s390x. Instead, all bare-metal POWER hosts are considered to be virtualization ready. For POWER, the validation is done by checking if the virtualization module kvm_hv is loaded in the host. If not, we should warn the user about it. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- tools/virt-host-validate-common.c | 27 +++++++++++++++++++++++++++ tools/virt-host-validate-common.h | 2 ++ tools/virt-host-validate-qemu.c | 15 +++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-c= ommon.c index dc7523dd86..fbefbada96 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -412,3 +412,30 @@ int virHostValidateIOMMU(const char *hvname, virHostMsgPass(); return 0; } + + +bool virHostKernelModuleIsLoaded(const char *module) +{ + FILE *fp; + bool ret =3D false; + + if (!(fp =3D fopen("/proc/modules", "r"))) + return false; + + do { + char line[1024]; + + if (!fgets(line, sizeof(line), fp)) + break; + + if (STRPREFIX(line, module)) { + ret =3D true; + break; + } + + } while (1); + + VIR_FORCE_FCLOSE(fp); + + return ret; +} diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-c= ommon.h index a20470fa72..8ae60a21de 100644 --- a/tools/virt-host-validate-common.h +++ b/tools/virt-host-validate-common.h @@ -82,3 +82,5 @@ int virHostValidateCGroupControllers(const char *hvname, =20 int virHostValidateIOMMU(const char *hvname, virHostValidateLevel level); + +bool virHostKernelModuleIsLoaded(const char *module); diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qem= u.c index ff3c1f0231..bd717a604e 100644 --- a/tools/virt-host-validate-qemu.c +++ b/tools/virt-host-validate-qemu.c @@ -57,6 +57,11 @@ int virHostValidateQEMU(void) if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE)) hasHwVirt =3D true; break; + case VIR_ARCH_PPC64: + case VIR_ARCH_PPC64LE: + hasVirtFlag =3D true; + hasHwVirt =3D true; + break; default: hasHwVirt =3D false; } @@ -84,6 +89,16 @@ int virHostValidateQEMU(void) ret =3D -1; } =20 + if (arch =3D=3D VIR_ARCH_PPC64 || arch =3D=3D VIR_ARCH_PPC64LE) { + virHostMsgCheck("QEMU", "%s", _("for PowerPC KVM module loaded")); + + if (!virHostKernelModuleIsLoaded("kvm_hv")) + virHostMsgFail(VIR_HOST_VALIDATE_WARN, + _("Load kvm_hv for better performance")); + else + virHostMsgPass(); + } + virBitmapFree(flags); =20 if (virHostValidateDeviceExists("QEMU", "/dev/vhost-net", --=20 2.24.1