From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 178E7620 for ; Tue, 9 Jul 2024 00:13:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720483990; cv=none; b=bEQKSPXBy/dE0/nekQEn5hYBoW0kTASf/ThnnQ9+GGgIlHKoPCjELZ/DHZK1BzETUl8IipBL97FDh8Jm1yJY/oWI8sR+ezjJpRctGklXTmV6E/1fYuKobGXSSvkakAIVPNvVDJ1fmCmd9RcSUvObcLrYrNKJe5cnJerPXuK8lRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720483990; c=relaxed/simple; bh=o7s7kP3xWOe9f8MorpJlnvVKDIDiP9CLOJFSGGX5mMY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=SXVk6qOWXooYJUzUZmqt0j30T5PKK/NaSscwtDmhC+Cl5WzSGD7Zo2YsHD9jP3mkTvr070bFZISzKGfspOL9mUhYg5yEAZ6HznEc+HsqoptnDnOoYnQxa9YqdcK0fuf1gBi5N+ko/Du8F10MMuZ3zB0mVDT0pMh1EymB/cOkOlI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XkOl4DHU; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XkOl4DHU" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-778702b9f8fso781991a12.1 for ; Mon, 08 Jul 2024 17:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720483988; x=1721088788; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zG6ZMKR2ER5CEkjEXyhneSznu6s7Jkh317FrChhPZ4A=; b=XkOl4DHUff0GorZQR3rR+qQ5ufi+8p6DIducAJJnGqltxaF07fG7pbyqyfQbOkAtTO XRo4sYj+J0u93tjzlBTvrGskpFiE8yaBFJaKQoEmbJbN4da4e9nAjO0+9MqYLJOqf+nW n7/AeR1XhsD05TdhirWCggu8dAsRnlDrnSKqa9w+UCag8DYkLX+EUm3grJGCozS/TiTu 6JbCxxcoRGTtkxTyaoYPh6mGdji/9X32cP2wXTRWraIipPBH2MI6WzAhNBYmvJYqa/vP 7cb8orZwvewTmSB0yeRiGn9gFko+X8F/pRIUFnVgYukxJWnKexSob36Ow0GL8zTVvngF y0Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720483988; x=1721088788; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zG6ZMKR2ER5CEkjEXyhneSznu6s7Jkh317FrChhPZ4A=; b=WzxnFIuBGKV7+xDxH2k36U0FDQpqPW8BO9sdFXb5C9QToLu59fz01qt8ymW7o1nWQi Yg9yrJyeCv6Muk9Fy5zvjthLmt5ANDz57HEdsuDgy5cjnAeWzAMYKYF2dd8gJfpPCx9U R707kHAO+gvbKBP0+zoHNe3In6d6t2uOBx3tWQge2Y0TYj4FZNvcQ9v39IzsnhPwZpEL mIM494G2Xb1+FMPj3T2xKIg7B/eEpGQ65q6ahzk8E/gby+0tgL8pE29+ycN45SsaBoT9 TQwb55xbLxjwNb0x+0lPY7OygvBDHg8eDUJbSnvI8+Xd59sIv4gfwTKSyxWY9QxeBrl4 PIoA== X-Forwarded-Encrypted: i=1; AJvYcCWJ1Ms5685ojK5xol844KiFSUCHfDQb2EcOP32SmWD3gd8eLUCdjPy4HVF5m3PRnW9MmvQXchKn0UjwRBWhDVZhUlIPd9D5OBf3qKCr X-Gm-Message-State: AOJu0YzgZKUyOmlxEKE6BS3aNQu0RfDgFjFmTZni1Kfa35Ud+yN38BuE SNpiJEC9kNbvG75aAtkgr4y5ztpIpHecNwITT+OGTF+QuGBDa3trBDJJJXuxHwh792ID6uesVly DdA== X-Google-Smtp-Source: AGHT+IEFGzOwGtA+dJ46COa5sR263gqpyt4UCMdQAj79zHoXHLuF9ZNvWfUjxPfnnXwwjfAp9CjrFIzSkCo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:502:b0:6f6:1f2c:e339 with SMTP id 41be03b00d2f7-77e004223b2mr2128a12.2.1720483988282; Mon, 08 Jul 2024 17:13:08 -0700 (PDT) Date: Mon, 8 Jul 2024 17:13:06 -0700 In-Reply-To: <960ef7f670c264824fe43b87b8177a84640b8b5d.camel@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240517173926.965351-1-seanjc@google.com> <20240517173926.965351-40-seanjc@google.com> <960ef7f670c264824fe43b87b8177a84640b8b5d.camel@redhat.com> Message-ID: Subject: Re: [PATCH v2 39/49] KVM: x86: Extract code for generating per-entry emulated CPUID information From: Sean Christopherson To: Maxim Levitsky Cc: Paolo Bonzini , Vitaly Kuznetsov , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Hou Wenlong , Kechen Lu , Oliver Upton , Binbin Wu , Yang Weijiang , Robert Hoo Content-Type: text/plain; charset="us-ascii" On Thu, Jul 04, 2024, Maxim Levitsky wrote: > On Fri, 2024-05-17 at 10:39 -0700, Sean Christopherson wrote: > PS: I spoke with Paolo about the meaning of KVM_GET_EMULATED_CPUID, because > it is not clear from the documentation what it does, or what it supposed to > do because qemu doesn't use this IOCTL. > > So this ioctl is meant to return a static list of CPU features which *can* be > emulated by KVM, if the cpu doesn't support them, but there is a cost to it, > so they should not be enabled by default. > > This means that if you run 'qemu -cpu host', these features (like rdpid) will > only be enabled if supported by the host cpu, however if you explicitly ask > qemu for such a feature, like 'qemu -cpu host,+rdpid', qemu should not warn > if the feature is not supported on host cpu but can be emulated (because kvm > can emulate the feature, which is stated by KVM_GET_EMULATED_CPUID ioctl). > > Qemu currently doesn't support this but the support can be added. > > So I think that the two ioctls should be redefined as such: > > KVM_GET_SUPPORTED_CPUID - returns all CPU features that are supported by KVM, > supported by host hardware, or that KVM can efficiently emulate. > > > KVM_GET_EMULATED_CPUID - returns all CPU features that KVM *can* emulate if > the host cpu lacks support, but emulation is not efficient and thus these > features should be used with care when not supported by the host (e.g only > when the user explicitly asks for them). Yep, that aligns with how I view the ioctls (I haven't read the documentaion, mainly because I have a terrible habit of never reading docs). > I can post a patch to fix this or you can add something like that to your > patch series if you prefer. Go ahead and post a patch, assuming it's just a documentation update.