Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp668896yba; Thu, 16 May 2019 07:10:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6zbbmC3WJC7pU5IbWu0LWAU0lmJ0yAA+K2OaZemUfzDo0Dn7r1yw6eBsgAjBEgQTQ+ym2 X-Received: by 2002:a17:902:f302:: with SMTP id gb2mr50231753plb.162.1558015819593; Thu, 16 May 2019 07:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558015819; cv=none; d=google.com; s=arc-20160816; b=QkgMNbOlXtoVkX2b1Bn3wP52dxN1gfMPu/PHXDelGa5+nusUqwb/dI8HrntplG4OII inu9IZELzXMVcRByZdKrhblPgB8PaCUWN/xBwIB0iAJl2KtwfAhK/LHnx42kqQ0pu1XF qcgJPvGp8k3knod/WmYONb2WrKVWTg4RAudQAhdKHQfmkoNTwWEoABV4A1yJsbcuD7y+ dcbSYLthqg+yJgK1kBOT/Tpp1HOEFZRZAyev8XVSvLA4T/6x9FRKEvq5desHnek1X2Gy tINNqd9RDJ10mJFkoPcjXz1OvXT/SyNPZ5HL07csu0NFupMD1/L7ZhiESmFS0eb2Y3Wd syMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=6AsMPu5n7/xRBGeC8coqQ6zOLFCMjhjLX1aaMredl0k=; b=cy2aPALA3trXpbpCfznwNNdk3NM/5SCGz2cS0Gm6nK0+X3an/qZ5c0WqSu5vCLMf6v tapAZh1BMb4UNNW6eDRnQ0KHGw85lOrpYRCWTh2VfumuIGueEaqpSbYIJkPoDbMp7pI5 k/KL8sn0oSb5/QbLgv6rhbKoYXoAmYqmzKNvVfCqc7fB3PBp/+SxF3e6X0aPROsrXq7Q KlXjSP6kIrlPkynCU19zq7IXhGTCVz1GBOeBBju8voNFdCA40aAARW4bPNnMlgL3Gxtj 3Hq1HKR7UE9zCtGOVOwJ0IxRqeJPRgLKvG1PzjmyCVCslN5o7ZqbueO+9W9XZ+GRG004 6OIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=mPSmqab5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 191si4924130pgh.596.2019.05.16.07.09.44; Thu, 16 May 2019 07:10:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=mPSmqab5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbfEPOIU (ORCPT + 99 others); Thu, 16 May 2019 10:08:20 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:6509 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726692AbfEPOIU (ORCPT ); Thu, 16 May 2019 10:08:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1558015698; x=1589551698; h=subject:to:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding; bh=6AsMPu5n7/xRBGeC8coqQ6zOLFCMjhjLX1aaMredl0k=; b=mPSmqab5dSEFK8tno9rFh8ca7PhUYtvYaO1ylJecA0QfeTQPA///Hf4w FBtc2MDZBo/BIOGVPR5elZi5REOBv53bweRgDYjbCnYCA6l9Yz+tHCghk IBkMoQ+cOyH+FbL4BPg4/QCEbJ6UtfmptHSnunmL45VQt0P2aksINyPyf c=; X-IronPort-AV: E=Sophos;i="5.60,476,1549929600"; d="scan'208";a="805009174" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1e-a70de69e.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 May 2019 14:08:16 +0000 Received: from EX13MTAUWC001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1e-a70de69e.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id x4GE8EcT105508 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 16 May 2019 14:08:15 GMT Received: from EX13D20UWC001.ant.amazon.com (10.43.162.244) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 16 May 2019 14:08:15 +0000 Received: from macbook-2.local (10.43.161.34) by EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 16 May 2019 14:08:14 +0000 Subject: Re: [Xen-devel] [PATCH v2 1/2] KVM: Start populating /sys/hypervisor with KVM entries To: Andrew Cooper , Filippo Sironi , , , , , , , References: <1539078879-4372-1-git-send-email-sironi@amazon.de> <1557847002-23519-1-git-send-email-sironi@amazon.de> <1557847002-23519-2-git-send-email-sironi@amazon.de> <7aae3e49-5b1c-96d1-466e-5b061305dc9d@citrix.com> From: Alexander Graf Message-ID: <22fadfb1-e48d-ccb6-0e42-c105b7335d7a@amazon.com> Date: Thu, 16 May 2019 07:08:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <7aae3e49-5b1c-96d1-466e-5b061305dc9d@citrix.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.43.161.34] X-ClientProxiedBy: EX13D27UWB002.ant.amazon.com (10.43.161.167) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.05.19 07:02, Andrew Cooper wrote: > On 16/05/2019 14:50, Alexander Graf wrote: >> On 14.05.19 08:16, Filippo Sironi wrote: >>> Start populating /sys/hypervisor with KVM entries when we're running on >>> KVM. This is to replicate functionality that's available when we're >>> running on Xen. >>> >>> Start with /sys/hypervisor/uuid, which users prefer over >>> /sys/devices/virtual/dmi/id/product_uuid as a way to recognize a virtual >>> machine, since it's also available when running on Xen HVM and on Xen PV >>> and, on top of that doesn't require root privileges by default. >>> Let's create arch-specific hooks so that different architectures can >>> provide different implementations. >>> >>> Signed-off-by: Filippo Sironi >> I think this needs something akin to >> >> https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-hypervisor-xen >> >> to document which files are available. >> >>> --- >>> v2: >>> * move the retrieval of the VM UUID out of uuid_show and into >>> kvm_para_get_uuid, which is a weak function that can be overwritten >>> >>> drivers/Kconfig | 2 ++ >>> drivers/Makefile | 2 ++ >>> drivers/kvm/Kconfig | 14 ++++++++++++++ >>> drivers/kvm/Makefile | 1 + >>> drivers/kvm/sys-hypervisor.c | 30 ++++++++++++++++++++++++++++++ >>> 5 files changed, 49 insertions(+) >>> create mode 100644 drivers/kvm/Kconfig >>> create mode 100644 drivers/kvm/Makefile >>> create mode 100644 drivers/kvm/sys-hypervisor.c >>> >> [...] >> >>> + >>> +__weak const char *kvm_para_get_uuid(void) >>> +{ >>> + return NULL; >>> +} >>> + >>> +static ssize_t uuid_show(struct kobject *obj, >>> + struct kobj_attribute *attr, >>> + char *buf) >>> +{ >>> + const char *uuid = kvm_para_get_uuid(); >>> + return sprintf(buf, "%s\n", uuid); >> The usual return value for the Xen /sys/hypervisor interface is >> "". > This string comes straight from Xen. > > It was an effort to reduce the quantity of interesting fingerprintable > data accessable by default to unprivileged guests. > > See > https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=a2fc8d514df2b38c310d4f4432fe06520b0769ed What a great design :). My point is mostly that we should be as common as possible when it comes to /sys/hypervisor, so that tools don't have to care about the HV they're working against. By being first to implement you just created precedence, so we can either simulate the same behavor for KVM or be different. And since commonality is good, I'd rather be the same. That said, I couldn't find in the patdch above whether Xen even emits for the uuid. Does it have that capability? If not, we may as well go with (null). Alex