From mboxrd@z Thu Jan 1 00:00:00 1970 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE5A0C4332F for ; Tue, 8 Nov 2022 05:36:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 193134B8C0; Tue, 8 Nov 2022 00:36:58 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 51S5+andP--f; Tue, 8 Nov 2022 00:36:56 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DACFD4B8C6; Tue, 8 Nov 2022 00:36:56 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 664EF4B8BC for ; Tue, 8 Nov 2022 00:36:55 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R04B6cya30JI for ; Tue, 8 Nov 2022 00:36:54 -0500 (EST) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 319614B8BB for ; Tue, 8 Nov 2022 00:36:54 -0500 (EST) Received: by mail-pj1-f52.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso16888477pjg.5 for ; Mon, 07 Nov 2022 21:36:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BySxdp/7FbkyS9rQ/+SYkYHjIbHSrwzWviAFRY2ZPdQ=; b=jlgow3Yb6SgeKXBbO3czTUh+xNvvjFHf5z9ViSJ61Te93gNnScVTxpPdHdT0l7k62F lMrHOG03BfSjw2UfLzDRH+RXS0WR4VTQobaYGOSlEeJAzgE29G9Fs3PTFtSoRNJ2lsDP rp0PpZoXb1pTQgLNwDewCRkXTSd0VD2UnGaEqh9OBYLx6U4QpTvTGuKtpRiWBAAdeDq6 BupIKIXcNl5Jz9YKhzqCZK1Zqb6IeNpvb7fpbUcyQY8vS/dUjH/ef8j3NZEU1GlKSkJ5 KtoaRb8jEUBKaeh9EDW7vyVfw83qUDyWWtZPLL7bbZyLBEvN6jw/u2ubAUqXn8x1atsw HieA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BySxdp/7FbkyS9rQ/+SYkYHjIbHSrwzWviAFRY2ZPdQ=; b=w2lzlXzyN4Q7cAoNnmacMR1ajekvyBjWuQB1kqGUBIkYjEXlPFDHYERPbdHgmj3dA/ r+AZBmhRR6uRHNycgq7uRVQYU5LFBCZu6xjJL7LhGqBLDsJ5Y1bHPFE5DLuZsb4iNVxQ r8Zu5agFINQzlAvNto1fej1QmQ2CvqShwn2R8xa04ChgpZOejSdp2ycUUn5Q5CzMxt22 wjXJ8e7/U+ikyfq1rDW+V7aCIPGPsd/POV2l7QBTsMBL2GKmo2xC6slL1wIJP0HOqRoO Z8dG/Vv3vi+bhXT8i6VlLBKy0eJaYf58bFBDqttXBcHgNn6YoOAwTkcFK3wz9mPIc03x N3fw== X-Gm-Message-State: ACrzQf3gZHv+yvHNLxtmeLTvg4WFBj4D/zrxTfkwaQIJKIy3/qfjQDY3 OWmeDH3zFB23TXIOBr3pMYzeiHDxVDQZk7lTiu7+3Q== X-Google-Smtp-Source: AMsMyM5h/BK7dlR9tXFEYHomDewWZpzTj+DR/oCqXMDG+trxJqZakFJMlhmhsO/VcM4HGEgEalX+qA4zQQDUKnfZXJ4= X-Received: by 2002:a17:902:7145:b0:187:2356:c29d with SMTP id u5-20020a170902714500b001872356c29dmr43846977plm.154.1667885812893; Mon, 07 Nov 2022 21:36:52 -0800 (PST) MIME-Version: 1.0 References: <20221028105402.2030192-1-maz@kernel.org> <20221028105402.2030192-12-maz@kernel.org> <87tu3gfi8u.wl-maz@kernel.org> <86bkpmrjv8.wl-maz@kernel.org> <87pme0fdvp.wl-maz@kernel.org> In-Reply-To: <87pme0fdvp.wl-maz@kernel.org> From: Reiji Watanabe Date: Mon, 7 Nov 2022 21:36:36 -0800 Message-ID: Subject: Re: [PATCH v2 11/14] KVM: arm64: PMU: Allow ID_AA64DFR0_EL1.PMUver to be set from userspace To: Marc Zyngier Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Marc, > > BTW, if we have no intention of supporting a mix of vCPUs with and > > without PMU, I think it would be nice if we have a clear comment on > > that in the code. Or I'm hoping to disallow it if possible though. > > I'm not sure we're in a position to do this right now. The current API > has always (for good or bad reasons) been per-vcpu as it is tied to > the vcpu initialisation. Thank you for your comments! Then, when a guest that has a mix of vCPUs with and without PMU, userspace can set kvm->arch.dfr0_pmuver to zero or IMPDEF, and the PMUVER for vCPUs with PMU will become 0 or IMPDEF as I mentioned. For instance, on the host whose PMUVER==1, if vCPU#0 has no PMU(PMUVER==0), vCPU#1 has PMU(PMUVER==1), if the guest is migrated to another host with same CPU features (PMUVER==1), if SET_ONE_REG of ID_AA64DFR0_EL1 for vCPU#0 is done after for vCPU#1, kvm->arch.dfr0_pmuver will be set to 0, and the guest will see PMUVER==0 even for vCPU1. Should we be concerned about this case? Thank you, Reiji _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E5477C4332F for ; Tue, 8 Nov 2022 05:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2svfVp/YTR1vnF2lDNQHLHA4vyqapYhFnmzmM9okCKs=; b=Fh6q1O/0CweTH/ 1Rpu4qGXfeqoD0mbm04JOD0Q3mAPvcxFnlI0VNy4WrU0hNaUycQfkAibayfd/8Vd93h/SBV4ZJ+AT Ak6DBRghUeFEoJjY3A8ylLwK2camHfMux1z+VSrmbCjIjU9C0UIqsjNkLxbrMfHwQcVsYPu/YOJNE Jr7ihvI3WJSvZaMqJU3XfkZvz0J3hYrKRdGhb1QfGG7wZ8iP1D6SdgA3lxduoacxIxHmFNmfj3v0d eyoqccJUAuoEHtVOInRKSBDN6hHKwqiOXc0vbUTXVoMANKzWv4nO0BruSke9wUhfn+oBaKb7EQXzW woJQCz+U4WX71Tg68NaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1osHIK-002ud2-Bl; Tue, 08 Nov 2022 05:37:08 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1osHIH-002ubv-Jr for linux-arm-kernel@lists.infradead.org; Tue, 08 Nov 2022 05:37:06 +0000 Received: by mail-pj1-x1035.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so12422935pjk.1 for ; Mon, 07 Nov 2022 21:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BySxdp/7FbkyS9rQ/+SYkYHjIbHSrwzWviAFRY2ZPdQ=; b=jlgow3Yb6SgeKXBbO3czTUh+xNvvjFHf5z9ViSJ61Te93gNnScVTxpPdHdT0l7k62F lMrHOG03BfSjw2UfLzDRH+RXS0WR4VTQobaYGOSlEeJAzgE29G9Fs3PTFtSoRNJ2lsDP rp0PpZoXb1pTQgLNwDewCRkXTSd0VD2UnGaEqh9OBYLx6U4QpTvTGuKtpRiWBAAdeDq6 BupIKIXcNl5Jz9YKhzqCZK1Zqb6IeNpvb7fpbUcyQY8vS/dUjH/ef8j3NZEU1GlKSkJ5 KtoaRb8jEUBKaeh9EDW7vyVfw83qUDyWWtZPLL7bbZyLBEvN6jw/u2ubAUqXn8x1atsw HieA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BySxdp/7FbkyS9rQ/+SYkYHjIbHSrwzWviAFRY2ZPdQ=; b=Hoeo/ROKMkutV765IE8EKejOBmgYRPCCUA4QJ+UYrCXSAANNGMC3MneZihoa/CV+J5 wZ/QU1Ske/jHVrpW2Nm18J28q0BxkqVnfYLe3q6Nl9jB3+BEQ10mfxsAkgCnHzSeKtPA OYuXT8MftejlCBafu7KbvngXiHrdJsf23V01XSY56FiwohFdvOgvz6KO5MVtI2y4qce5 Mk9laHYBI8ca2rpCeAJZApamR3stjuwrjFtKWB1/+ttOSi3yoCaV0NqHvkhWMEEch/Hw Ja4ipYCSVtXyL77agbIkmIDydjjd4L4KPM9issGXyrezIu+ajONHKmaMgAYIfX/WcTiE Ppag== X-Gm-Message-State: ACrzQf1PQMdiy2EpN0OEUye35MKApErGAsRf2tMlcC6wZtBPNZwvlSbQ IC/tDFLHyd25MmG/9Ed/NjSToTDaYKIsjq4iFDon4Q== X-Google-Smtp-Source: AMsMyM5h/BK7dlR9tXFEYHomDewWZpzTj+DR/oCqXMDG+trxJqZakFJMlhmhsO/VcM4HGEgEalX+qA4zQQDUKnfZXJ4= X-Received: by 2002:a17:902:7145:b0:187:2356:c29d with SMTP id u5-20020a170902714500b001872356c29dmr43846977plm.154.1667885812893; Mon, 07 Nov 2022 21:36:52 -0800 (PST) MIME-Version: 1.0 References: <20221028105402.2030192-1-maz@kernel.org> <20221028105402.2030192-12-maz@kernel.org> <87tu3gfi8u.wl-maz@kernel.org> <86bkpmrjv8.wl-maz@kernel.org> <87pme0fdvp.wl-maz@kernel.org> In-Reply-To: <87pme0fdvp.wl-maz@kernel.org> From: Reiji Watanabe Date: Mon, 7 Nov 2022 21:36:36 -0800 Message-ID: Subject: Re: [PATCH v2 11/14] KVM: arm64: PMU: Allow ID_AA64DFR0_EL1.PMUver to be set from userspace To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Ricardo Koller X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221107_213705_712669_56930698 X-CRM114-Status: GOOD ( 14.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, > > BTW, if we have no intention of supporting a mix of vCPUs with and > > without PMU, I think it would be nice if we have a clear comment on > > that in the code. Or I'm hoping to disallow it if possible though. > > I'm not sure we're in a position to do this right now. The current API > has always (for good or bad reasons) been per-vcpu as it is tied to > the vcpu initialisation. Thank you for your comments! Then, when a guest that has a mix of vCPUs with and without PMU, userspace can set kvm->arch.dfr0_pmuver to zero or IMPDEF, and the PMUVER for vCPUs with PMU will become 0 or IMPDEF as I mentioned. For instance, on the host whose PMUVER==1, if vCPU#0 has no PMU(PMUVER==0), vCPU#1 has PMU(PMUVER==1), if the guest is migrated to another host with same CPU features (PMUVER==1), if SET_ONE_REG of ID_AA64DFR0_EL1 for vCPU#0 is done after for vCPU#1, kvm->arch.dfr0_pmuver will be set to 0, and the guest will see PMUVER==0 even for vCPU1. Should we be concerned about this case? Thank you, Reiji _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A379DC4332F for ; Tue, 8 Nov 2022 05:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232548AbiKHFg4 (ORCPT ); Tue, 8 Nov 2022 00:36:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiKHFgz (ORCPT ); Tue, 8 Nov 2022 00:36:55 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A7A6183B3 for ; Mon, 7 Nov 2022 21:36:53 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id y4so13234742plb.2 for ; Mon, 07 Nov 2022 21:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BySxdp/7FbkyS9rQ/+SYkYHjIbHSrwzWviAFRY2ZPdQ=; b=jlgow3Yb6SgeKXBbO3czTUh+xNvvjFHf5z9ViSJ61Te93gNnScVTxpPdHdT0l7k62F lMrHOG03BfSjw2UfLzDRH+RXS0WR4VTQobaYGOSlEeJAzgE29G9Fs3PTFtSoRNJ2lsDP rp0PpZoXb1pTQgLNwDewCRkXTSd0VD2UnGaEqh9OBYLx6U4QpTvTGuKtpRiWBAAdeDq6 BupIKIXcNl5Jz9YKhzqCZK1Zqb6IeNpvb7fpbUcyQY8vS/dUjH/ef8j3NZEU1GlKSkJ5 KtoaRb8jEUBKaeh9EDW7vyVfw83qUDyWWtZPLL7bbZyLBEvN6jw/u2ubAUqXn8x1atsw HieA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BySxdp/7FbkyS9rQ/+SYkYHjIbHSrwzWviAFRY2ZPdQ=; b=y7BBNnFgi0T2no3a9/lK8+seaL0X/6NewQv/ifvmoibZd8+ueB6RwGyQIONLElBv1A 1qU1IXdxgBgyoTj9vPScNTmAu+CiPgWhtwkh7HbrqKfCpB0JEiFf7+hhGPzUGYGOiIIE ktAwrH9B4iBu0bNYV8cEdxPDzqa+xzRhTPso5sgE1C7o5Ty/uaTQvBGyivgmNnPFzD3X hPRfqG+LArYnhH4x+tooOpVWqdbcvwgDscKVWHw3WW/ez9V4OkgFkkjxivFNqBpCZQl0 0nn9pgzS4qfIsQayvj0n9nslsXqeq2V7MwsVhm7zgUE6oHahHEis/O7SWZb6XmaN0Bdf qtqg== X-Gm-Message-State: ACrzQf2MqlzDz5xhvYIUTJmbN6zghn4Hs8ni6UTqzswSYOAJvgHMOxyu CDQVUKYuTiova9xkz11537RdAX/au83LH0JwHm0COg== X-Google-Smtp-Source: AMsMyM5h/BK7dlR9tXFEYHomDewWZpzTj+DR/oCqXMDG+trxJqZakFJMlhmhsO/VcM4HGEgEalX+qA4zQQDUKnfZXJ4= X-Received: by 2002:a17:902:7145:b0:187:2356:c29d with SMTP id u5-20020a170902714500b001872356c29dmr43846977plm.154.1667885812893; Mon, 07 Nov 2022 21:36:52 -0800 (PST) MIME-Version: 1.0 References: <20221028105402.2030192-1-maz@kernel.org> <20221028105402.2030192-12-maz@kernel.org> <87tu3gfi8u.wl-maz@kernel.org> <86bkpmrjv8.wl-maz@kernel.org> <87pme0fdvp.wl-maz@kernel.org> In-Reply-To: <87pme0fdvp.wl-maz@kernel.org> From: Reiji Watanabe Date: Mon, 7 Nov 2022 21:36:36 -0800 Message-ID: Subject: Re: [PATCH v2 11/14] KVM: arm64: PMU: Allow ID_AA64DFR0_EL1.PMUver to be set from userspace To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Ricardo Koller Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Marc, > > BTW, if we have no intention of supporting a mix of vCPUs with and > > without PMU, I think it would be nice if we have a clear comment on > > that in the code. Or I'm hoping to disallow it if possible though. > > I'm not sure we're in a position to do this right now. The current API > has always (for good or bad reasons) been per-vcpu as it is tied to > the vcpu initialisation. Thank you for your comments! Then, when a guest that has a mix of vCPUs with and without PMU, userspace can set kvm->arch.dfr0_pmuver to zero or IMPDEF, and the PMUVER for vCPUs with PMU will become 0 or IMPDEF as I mentioned. For instance, on the host whose PMUVER==1, if vCPU#0 has no PMU(PMUVER==0), vCPU#1 has PMU(PMUVER==1), if the guest is migrated to another host with same CPU features (PMUVER==1), if SET_ONE_REG of ID_AA64DFR0_EL1 for vCPU#0 is done after for vCPU#1, kvm->arch.dfr0_pmuver will be set to 0, and the guest will see PMUVER==0 even for vCPU1. Should we be concerned about this case? Thank you, Reiji