Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3299409rdg; Tue, 17 Oct 2023 10:09:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKp6mhKb2znzCA8muhXyWIfSyGoUFSnEhZ9nNwAqainuMpu8dF8Po5iO8WGYcn6ddEll+T X-Received: by 2002:a05:6a20:6a20:b0:15d:1646:285a with SMTP id p32-20020a056a206a2000b0015d1646285amr3472738pzk.21.1697562569104; Tue, 17 Oct 2023 10:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697562569; cv=none; d=google.com; s=arc-20160816; b=bUlDmaYjF08yedCpJzCqB9uc38gIPbwlztFbN5HIN00rx+axDSmgj6L2uGMihR7Ay6 taiBSwJbcK++l81wi1EsKSpXKZkgIW0Bcq4Q8u58fHyBVC8yR7XGqSbSqOZsgckUwjuz tPp6EiddijUFsIarcIzEhGpc6/4kDJQkTcVkMUINZU4aARLJ/gRzEKRSArJI/Y6tjK2v eNIcOsUlmvDTgkWg4WiG886fxNlmznRkQcubrzmMpAhikioWPRgx/R+K8yDMHl5sSq0a JaIXKN23C4KOEqhpVXOWnJcAGPOcvF6ByMNNUKHJhPBZqS/DQimRhgBbNuvDk2T90Goe MwiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=7Rfv7r/GuU3poBoBBegpc3MH7nKblNdFhx9LayDfN/g=; fh=w0flhQl7mctFcbI2b5EuDMWx0RWmm/SggScYTmVZk3E=; b=FMNvkY/KAZz5ZGH7pD6DIPn/eSAClDfrZl0ioKFb3Vo4XbMS9Ovum6Q7srJPfHbeVv 5cAR0GzbASpTkX6RMpRZZpVIqwRuUZdh9nnfD9cdhcTNCwvqx5ryiw29pRBJKllyNAy+ Fabw1fugi+LOZjtDbiwm6VTBbi/zun6kAwU5yYiNckg8nWMk8fwTCizhUdqgLrusY9io +5Nu0M7Z0cLQ53kXddiqUz+MNud1cLFPC1503R24T8qDM/QJtBjhjRSU80RV8tgQ4SXD A6tVbzgPc4Z+my7/rwG8MstGBwb/3zz3gWvAvoePiEVtbVxN5ncc2aLVZepfOPkRHLaR R5gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TFgn2b52; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id n128-20020a634086000000b00564929df8besi164709pga.568.2023.10.17.10.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 10:09:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TFgn2b52; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A16F98025435; Tue, 17 Oct 2023 10:09:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234896AbjJQRJV (ORCPT + 99 others); Tue, 17 Oct 2023 13:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbjJQRJU (ORCPT ); Tue, 17 Oct 2023 13:09:20 -0400 Received: from out-208.mta0.migadu.com (out-208.mta0.migadu.com [IPv6:2001:41d0:1004:224b::d0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F70FD for ; Tue, 17 Oct 2023 10:09:17 -0700 (PDT) Date: Tue, 17 Oct 2023 17:09:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697562555; 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=7Rfv7r/GuU3poBoBBegpc3MH7nKblNdFhx9LayDfN/g=; b=TFgn2b52np5IlEuu1uUS0tBRQpxK65WkA4Rmi+nvkk/K2SazzQgS5KeQwEiHqQ4qLjybb1 Dr7lvKVLwFmwGHOmJ4Gks+3K03eT7PtCqdqC4B+auUvybaYnVf/F8Ngan61k6vSXRyYqP/ 9jzXApHjjRRK96UwkrZJfelaWWrcczk= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Raghavendra Rao Ananta Cc: Sebastian Ott , Marc Zyngier , Alexandru Elisei , James Morse , Suzuki K Poulose , Paolo Bonzini , Zenghui Yu , Shaoqin Huang , Jing Zhang , Reiji Watanabe , Colton Lewis , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v7 07/12] KVM: arm64: PMU: Set PMCR_EL0.N for vCPU based on the associated PMU Message-ID: References: <20231009230858.3444834-1-rananta@google.com> <20231009230858.3444834-8-rananta@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 17 Oct 2023 10:09:26 -0700 (PDT) On Tue, Oct 17, 2023 at 09:58:08AM -0700, Raghavendra Rao Ananta wrote: > On Mon, Oct 16, 2023 at 10:52 PM Oliver Upton wrote: > > > > On Mon, Oct 16, 2023 at 02:35:52PM -0700, Raghavendra Rao Ananta wrote: > > > > [...] > > > > > > What's the point of doing this in the first place? The implementation of > > > > kvm_vcpu_read_pmcr() is populating PMCR_EL0.N using the VM-scoped value. > > > > > > > I guess originally the change replaced read_sysreg(pmcr_el0) with > > > kvm_vcpu_read_pmcr(vcpu) to maintain consistency with others. > > > But if you and Sebastian feel that it's an overkill and directly > > > getting the value via vcpu->kvm->arch.pmcr_n is more readable, I'm > > > happy to make the change. > > > > No, I'd rather you delete the line where PMCR_EL0.N altogether. > > reset_pmcr() tries to initialize the field, but your > > kvm_vcpu_read_pmcr() winds up replacing it with pmcr_n. > > > I didn't get this comment. We still do initialize pmcr, but using the > pmcr.n read via kvm_vcpu_read_pmcr() instead of the actual system > register. You have two bits of code trying to do the exact same thing: 1) reset_pmcr() initializes __vcpu_sys_reg(vcpu, PMCR_EL0) with the N field set up. 2) kvm_vcpu_read_pmcr() takes whatever is in __vcpu_sys_reg(vcpu, PMCR_EL0), *masks out* the N field and re-initializes it with vcpu->kvm->arch.pmcr_n Why do you need (1) if you do (2)? -- Thanks, Oliver