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 C4FB1C001DB for ; Mon, 14 Aug 2023 07:17:03 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OREHreY8iRVnS//NM8tfQN85yXumCPloi4tLhnN6Nmc=; b=OMstaxVsgpYnXO Q4otCdrhnejkPZ9rzTO20zRxWc0t6IFC60rK+bXMLu39zftLXG5OCGY0s29tpDq/fL61ZHODoAES9 GysSAnpN5ewVEJ1YG+bpUoBBpd8zQieY3eLbT1yZ65Ilff/nUZKiENJRF2FoHZ+gwl4OmfD1+/5TI 5zQRPFl3joyxIHJ4fsZJw2Ft58eVqPh9gl1Fl2FxNDxaRD9omOowztrK7d77o1Viu2IKAqjRvRH5m kZKRWl3BPhFgDazyIJ1u991Q3DndDsETYS8ZyPgQhbXOOtyDyS9YWKkrfatJbmQlNRjUiqLdg9jwh D55JZyX+etLWBZoj6oDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVRof-00GLXh-00; Mon, 14 Aug 2023 07:16:41 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVRob-00GLX0-1s for linux-arm-kernel@lists.infradead.org; Mon, 14 Aug 2023 07:16:39 +0000 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-686e0213c0bso2489584b3a.1 for ; Mon, 14 Aug 2023 00:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691997395; x=1692602195; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Pxp+IVEo0LKe0kgUuQrVGmpE70BNyACEd+AbijZumyk=; b=aGHqzk25bhTA5rrUJpEWfg/0Irz7jPSUNTusETayJFw6z/kArbtpNZHsdJI+US10xH igEiQyydGfdRk9izJRawtbK3//yEIV+sL6L9Huf/LNNGqjdDnjkLYy45xlQerEs636fk t9nmwOLPEAn3iU5IQL3D/+ZpBsalmDTyNH9aGuSrKZO5UPoKVQyqwbstpTGuD5BvHsm/ zabciBwL8HIf7OS7+iHALkO1VLQUKrWK8tqo0c2cKRZarrj4ooRHJMUqQMcUI/SQfgI3 qV1Xjd5VPE4jSQWlwCg1yhYY+Idld/ofMIRRExFVWa4gi4AA0w5WvH1O50c1jLjRvH0c e02g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691997395; x=1692602195; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Pxp+IVEo0LKe0kgUuQrVGmpE70BNyACEd+AbijZumyk=; b=T907283UL03ItVver/SoDR+5pNDj+bwMoaWfMZ+OQLK1idfQZpoYjRB9H3ZtKjrAq3 H9s2kX8MCXFEHPsxKUYEC82hJ70kW0yjA5I/Q/BFV4vi4C6ima9tV1CcwH9vfcRbQM/w cisH85eoHR2NbwJOk2c8CPt/WxvIvIqQkTUJqq8CFcevGEcch6p2qZjRpDthGy37FXWa 5eOfN9y65+X5Z4/VMRzy61TXWwWr7sB6V9dh1rSEO5kKWhTX1/iJdnalg3a3K4ufZ7mF FtaE1nhuHr75Mwr7ih/MxxgkVeiWODooOY11ykVTmxQVXDR95epuoyPzii5lRaD6ytuk baiQ== X-Gm-Message-State: AOJu0YybLY58VPwFuKsVKPwzxoPxj4hhqHOBgesSLD2PDLvIo6P4etjD Sx1NK2W1yhoqqvym9RMUes1R1g== X-Google-Smtp-Source: AGHT+IFy66tVYM+eFPd/cnoMV4AFYDumjWr4SaF0Sp+xYXJpuncgwIiPc+ybmY2I9j3r5sKkt+w+LQ== X-Received: by 2002:a05:6a20:5487:b0:140:54ab:7f43 with SMTP id i7-20020a056a20548700b0014054ab7f43mr9312549pzk.52.1691997395017; Mon, 14 Aug 2023 00:16:35 -0700 (PDT) Received: from leoy-huanghe ([150.230.248.162]) by smtp.gmail.com with ESMTPSA id u20-20020a62ed14000000b006870b923fb3sm7213588pfh.52.2023.08.14.00.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 00:16:34 -0700 (PDT) Date: Mon, 14 Aug 2023 15:16:27 +0800 From: Leo Yan To: Marc Zyngier Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Huang Shijie , Mark Rutland , Will Deacon Subject: Re: [PATCH] KVM: arm64: pmu: Resync EL0 state on counter rotation Message-ID: <20230814071627.GA3963214@leoy-huanghe> References: <20230811180520.131727-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230811180520.131727-1-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230814_001637_691902_D1777A53 X-CRM114-Status: GOOD ( 14.15 ) 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 On Fri, Aug 11, 2023 at 07:05:20PM +0100, Marc Zyngier wrote: > Huang Shijie reports that, when profiling a guest from the host > with a number of events that exceeds the number of available > counters, the reported counts are wildly inaccurate. Without > the counter oversubscription, the reported counts are correct. > > Their investigation indicates that upon counter rotation (which > takes place on the back of a timer interrupt), we fail to > re-apply the guest EL0 enabling, leading to the counting of host > events instead of guest events. Seems to me, it's not clear for why the counter rotation will cause the issue. In the example shared by Shijie in [1], the cycle counter is enabled for both host and guest, and cycle counter is a dedicated event which does not share counter with other events. Even there have counter rotation, it should not impact the cycle counter. I mean if we cannot explain clearly for this part, we don't find the root cause, and this patch (and Shijie's patch) just walks around the issue. Thanks, Leo [1] https://lore.kernel.org/lkml/20230810072906.4007-1-shijie@os.amperecomputing.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel