Received: by 2002:a19:711a:0:0:0:0:0 with SMTP id m26csp424513lfc; Wed, 3 Jun 2020 04:45:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwR5k2gjx9a9rDfItNtwuUQij3mrj/TiKw0TZ//wQksh0tcrqqDkehDDRKCLzUBlnZDxdH X-Received: by 2002:a25:8084:: with SMTP id n4mr48005845ybk.102.1591184741100; Wed, 03 Jun 2020 04:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591184741; cv=none; d=google.com; s=arc-20160816; b=wlSx1eJSnR4wIYIrZqRetS9M8O2eAKVecyrmmd23iSVvQ9NNocjyjaEyn6rRDt0nTE jkOOQZV8GRDK/m0cjS8gL4F9e4/BkdwZcqJ1/SwYpKFVPgzr38W6eBwRGEEr2UgWKOgQ M2RH4qu114ByG55WHzLP/0A+nOydSE0PhTYDTKjm7ZP71CCrg3atcXXO+inJZ4Du/3rL x0pVUHsQyq/bYjJWXs5N2LN8WHUK1WFleYspvYq2XVcXMfDYZqoQF2hF5cWrH54/19yh JCF9/U0RVf+x+N4p7pv64ddSrzum6ZIOIcv95fp5Cv52P5m2Yzv1ROOoic+GeQ2w7k70 Yzyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:to:from; bh=dE5OSyifT3cQJLGGJhIWFamn7DJiEFoyANez3U5Mp/s=; b=wD2n+04JDX7HmmUQfVKpzeGu9RfzntCBBXur55RO+xWyhSjHNb6i34t1DMU8sNtDOC caC9LydjRu6nLkaHv8DMY3+zmC9kTgcMryCj+XOAaMdYdfKFd6QaYax7TstyFMumeaeb Yg//xoBMU0neMZFPi+iNqRK7srTv2bryInZTnZrSvj6p+Upl3hhOE4N/+aORKcKDXu86 5baHYi1uOWB2hlqVGecXUZonhHkKnyUSpZ2RLyfVkDwhn93Qje6Fe+zEy16Cr68Nx+Pb Zx9W+RKswTpeVPvDljm8zYT47igBlnD4kb6PrbPKFJoBJSE9Dsh2h5/ExigQ7mgGtUw/ NIug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n7si1590446yba.144.2020.06.03.04.45.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Jun 2020 04:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:40106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgRq0-0002zF-G4 for alex.bennee@linaro.org; Wed, 03 Jun 2020 07:45:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgRpp-0002x7-Oo; Wed, 03 Jun 2020 07:45:29 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2103 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgRpn-0002Wk-6u; Wed, 03 Jun 2020 07:45:29 -0400 Received: from lhreml703-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id A641A849E07C51F2A10C; Wed, 3 Jun 2020 12:45:22 +0100 (IST) Received: from lhreml703-chm.china.huawei.com (10.201.108.52) by lhreml703-chm.china.huawei.com (10.201.108.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Wed, 3 Jun 2020 12:45:22 +0100 Received: from lhreml703-chm.china.huawei.com ([10.201.68.198]) by lhreml703-chm.china.huawei.com ([10.201.68.198]) with mapi id 15.01.1913.007; Wed, 3 Jun 2020 12:45:22 +0100 From: Salil Mehta To: Andrew Jones Subject: RE: [Question] Regarding PMU initialization within the QEMU for ARM VCPUs Thread-Topic: [Question] Regarding PMU initialization within the QEMU for ARM VCPUs Thread-Index: AdY3+/mIYt1+TQdDQmymnxAa7PkUWwBhkdKAAAS79tA= Date: Wed, 3 Jun 2020 11:45:22 +0000 Message-ID: <6bacdd359e504ed8924e67ed125bf15d@huawei.com> References: <20200603093745.dwfb55ny34az7rez@kamzik.brq.redhat.com> In-Reply-To: <20200603093745.dwfb55ny34az7rez@kamzik.brq.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.30.55] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Received-SPF: pass client-ip=185.176.76.210; envelope-from=salil.mehta@huawei.com; helo=huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/03 07:45:22 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "mst@redhat.com" , "qemu-devel@nongnu.org" , "eric.auger@redhat.com" , "qemu-arm@nongnu.org" , Igor Mammedov Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: tN7Z8USRybbf Hi Andrew, Many thanks for the reply. > From: Andrew Jones [mailto:drjones@redhat.com] > Sent: Wednesday, June 3, 2020 10:38 AM > To: Salil Mehta > Cc: qemu-devel@nongnu.org; qemu-arm@nongnu.org; Peter Maydell > ; Igor Mammedov ; > mst@redhat.com > Subject: Re: [Question] Regarding PMU initialization within the QEMU for = ARM > VCPUs >=20 > On Mon, Jun 01, 2020 at 03:04:33PM +0000, Salil Mehta wrote: > > Hello, > > I could see below within function fdt_add_pmu_nodes() part of > > hw/arm/virt.c during virt machine initialization time: > > > > Observation: > > In below function, support of PMU feature is being checked for > > each vcpu and if the PMU is found part of the features then PMU > > is initialized with in the host/KVM. But if there is even one > > vcpu which is found to not support the PMU then loop is exited > > and PMU is not initialized for the rest of the vcpus as well. > > > > Questions: > > Q1. Not sure what is the logic of the premature exit and not > > continuing with further checks and initialization of other > > VCPU PMUs? >=20 > KVM requires all VCPUs to have a PMU if one does. If the ARM ARM > says it's possible to have PMUs for only some CPUs, then, for TCG, > the restriction could be relaxed. I expect it will take more than > just removing the check for things to work though. Got it. Many thanks for this info. During virt machine init we take cpu type from (-cpu ) option and it should apply evenly to all of the vcpus. Therefore, I can assume all of the processors to be identical for now. This combined with the KVM restriction you mentioned above means for PMU we could only have Enable-for-All OR Enable-for-none config for all of the vcpus being booted even though we at different places do have per-vcpu specific check like below available /* MADT */ static void build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { [...] for (i =3D 0; i < vms->smp_cpus; i++) { AcpiMadtGenericCpuInterface *gicc =3D acpi_data_push(table_data, sizeof(*gicc)); [...] if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {---> This check gicc->performance_interrupt =3D cpu_to_le32(PPI(VIRTUAL_PMU_IRQ= )); } [...] } Do per-vcpu feature check for PMU even makes sense till we allow heterogeneous support of processors or relax the PMU enablement on the per-vcpu basis within the KVM? >=20 > > Q2. Does it even makes sense to have PMUs initialized for some > > vcpus and not for others unless we have heterogeneous system? >=20 > I don't know, but it doesn't sound like a configuration I'd like > to see. sure. but in the existing code we do prematurely exit after we discover first vcpu amongst the possible vcpus not supporting PMU feature. This looks abnormal as well? >=20 > > Q3. Also, there is a per virt machine knob of vcc->no_pmu. > > This is something which user could specify at the init time > > and perhaps only once but we don't use it for ARM. Perhaps > > should have been used even before entering this function > > to enable or disable the support as per user config? >=20 > It's purpose is to keep users from doing 'pmu=3Don' on 2.6 machine > types. On 2.7 and later machine types if you don't want a PMU > you should use 'pmu=3Doff'. sure. so by default on latest machines PMU is on.=20 >=20 > > Q4. This function fdt_* looks to be wrongly named. The info > > being initialized here shall be used even when ACPI is > > being used. Initialization part and FDT info looked > > mixed up here if I am right? >=20 > Agreed. The function has the wrong name. mach-virt has many functions tha= t > mix the initialization and fdt building together, but those functions are > named something like create_foo(). Patches welcome. Will do. I have created one already. Will float soon. >=20 > Thanks, > drew