Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2302676ybg; Fri, 5 Jun 2020 10:25:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy295BspXwc31TuhTNoprw7Qf/pRMdfoIbrBRzk6qERuScTG3vfEUsdPLQx720VpsZ0vaGf X-Received: by 2002:a17:906:1a47:: with SMTP id j7mr9462720ejf.356.1591377904691; Fri, 05 Jun 2020 10:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591377904; cv=none; d=google.com; s=arc-20160816; b=kaHWMhHYIXa6n2rcCKTfbAfiFdopof17Vgbm84O22k/fRMuLT0bABlzba+1h9UAO9O pILBtzr3wrEE8SbGNpbfDJIaJhpPC3gVdGgMOza9vcw9p59RYd3kNLLn2Jc+Wg2ZunFs QS+b2lfq9SZw1BleV9CLzx4KolI2rT1NnXXPvwKDPwsqDkFPvxWjjZm0zz3lXdx7WJD6 ChINL8m46NQr+BM2xcsRUm9KIPQKmEiBFrYv6qKHirVE9Ni7+r85OKcAkHNzapfeUWan G0a9sYVEOHjRyF6GgByxK+bV7ONmGV9qDQOm6SCsnUHgq55IcmtIudkUl+Ju0LSFOD05 jFqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=RuGOZnvDJQpKp0vYUjuXJhQewOvwWhd7fsqAjWE3CVg=; b=TG2Nx/Mj1QRUp+JD4SOOEY+kwaPi2W2XtpmK9EAIVCYSum6DTh68mfZA7hkA0l9UsM Hu4TXlwUxTTTB0qUyS/0WTA9f9UqibMOQa3a0EO1I//Qi3/YWoJ/Fu0rFXvGtHUaBUNe LpiNtzjhf/vEjhiphL4eNuucLe57hNEEm+UIvbTonL7c7z2/6hqOCie9h2CajGK+y+WI +VrV2QvTHX5Tm8eJy0oSaF73IyhluqO9Ri9xWr9aMhCCBHiGry4qjwCukfZXk1Mvv/73 11CyD0yifwcKF6RZS3nGxWK0b9J8ifD5z3A2WEBJJ/PvDfaBIlfsVgXgpvmAr9cGvp60 sdxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g1626IfH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si4220370edf.484.2020.06.05.10.24.40; Fri, 05 Jun 2020 10:25:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g1626IfH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbgFERWJ (ORCPT + 99 others); Fri, 5 Jun 2020 13:22:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20751 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726885AbgFERWI (ORCPT ); Fri, 5 Jun 2020 13:22:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591377726; h=from:from: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; bh=RuGOZnvDJQpKp0vYUjuXJhQewOvwWhd7fsqAjWE3CVg=; b=g1626IfHyB6QfQ0W+j8pIHCLXHFlhzLZguhdJHSt5s80+RzFrJD/SuVA2VUvOfYr8x6poO zBtCJX+xjFxM4SBh1LSuM+lgSDUZPnArnLYSpAD8/j+GMpyMcvCPhi/MWQupbVh7am4ESp iLh/RXtGURKES8zQ/Y4CZH4w4XJVudc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-AUpy80pMO8SqAQST4-oqSg-1; Fri, 05 Jun 2020 13:22:05 -0400 X-MC-Unique: AUpy80pMO8SqAQST4-oqSg-1 Received: by mail-wr1-f69.google.com with SMTP id d6so4034326wrn.1 for ; Fri, 05 Jun 2020 10:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RuGOZnvDJQpKp0vYUjuXJhQewOvwWhd7fsqAjWE3CVg=; b=EAQTRGPGT+Fd6UtfkxYtFsL+RhKMR2Dkkv6oMgwsyr7zSTScr5vU6fkUQPtF+LZxdA 9hlGM6u/5kph1fClo6xrZClDZc+F3Ml2jOGL/mLy39W4Iyedq5c/WqPmFQ5own4Ub8Qa ZNZfjld9lWcfxu6tKH4GnQGPt9MZzkj/uHsht+oWH9cqOmT2M7+IEiDkYqP8+lc5aZ7B hPQh5DGHOKR1z6oRXr6EzBFQcn31ckE+gnAJCz2ef3O9CmQKwKEc9kEIroST5/MD8DUY SQF0ZKNJmoBNBN4yuh8XhvY1L2DMOom6tguuq0j0V8n5ooCJ2cpBWwUJZqitvPhdNZV7 QgyA== X-Gm-Message-State: AOAM531QPffUp1AyplJjIIVlfSDmqMkMztQlLJi4xyQLYOOLQl1rtody AvS038/FmvXkCqZdBB/4dUbNg8ayOsLdqlWgJrfgwYRhZ2eftz7A0dk2HegGBwBsP0PeL0ct2MP /NhXpViEKzCruLK1ZJPmPe8zn X-Received: by 2002:a1c:a3c5:: with SMTP id m188mr3603534wme.152.1591377724075; Fri, 05 Jun 2020 10:22:04 -0700 (PDT) X-Received: by 2002:a1c:a3c5:: with SMTP id m188mr3603512wme.152.1591377723877; Fri, 05 Jun 2020 10:22:03 -0700 (PDT) Received: from [192.168.178.58] ([151.20.243.176]) by smtp.gmail.com with ESMTPSA id j11sm12720518wru.69.2020.06.05.10.22.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jun 2020 10:22:03 -0700 (PDT) Subject: Re: [PATCH][v6] KVM: X86: support APERF/MPERF registers To: Jim Mattson Cc: Xiaoyao Li , Li RongQing , LKML , kvm list , the arch/x86 maintainers , "H . Peter Anvin" , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , wei.huang2@amd.com References: <1591321466-2046-1-git-send-email-lirongqing@baidu.com> <72a75924-c3cb-6b23-62bd-67b739dec166@redhat.com> From: Paolo Bonzini Message-ID: Date: Fri, 5 Jun 2020 19:22:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/06/20 19:16, Jim Mattson wrote: >>>> @@ -4930,6 +4939,11 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, >>>> kvm->arch.exception_payload_enabled = cap->args[0]; >>>> r = 0; >>>> break; >>>> + case KVM_CAP_APERFMPERF: >>>> + kvm->arch.aperfmperf_mode = >>>> + boot_cpu_has(X86_FEATURE_APERFMPERF) ? cap->args[0] : 0; >>> Shouldn't check whether cap->args[0] is a valid value? >> Yes, only valid values should be allowed. >> >> Also, it should fail with -EINVAL if the host does not have >> X86_FEATURE_APERFMPERF. > Should enabling/disabling this capability be disallowed once vCPUs > have been created? > That's a good idea, yes. Paolo