Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3409071pxj; Tue, 1 Jun 2021 04:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMMCXqbyhayHGhNMMWcqPg7Qr+IwnkC80SScS8uRtMW0ScbSI9yn+wgs/KFD/EIbkEqrJy X-Received: by 2002:a17:906:8810:: with SMTP id zh16mr11190740ejb.268.1622548115683; Tue, 01 Jun 2021 04:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622548115; cv=none; d=google.com; s=arc-20160816; b=U35TRIijkJD9YfKUDhFaxp3PjFBjUkdLQBRBoLOG1jL0mYqDLsO7lyITUIyeZUWkNI XqPp4Xd+gU8BNHs1S8HMNzJcCqs189Z+YsNHBjmAo9O6IiJpTDOW+r4YAAlITxbn4Z6m YUtKkisttbWdCsytO1TPCYO3fLA7nTrmcLkDz9lWI84i35zctx9MmRBuKJepR6ecqyZS 2b9plkIWnw0zlU57AGb3gVvjUpgqpW9UGISZ5GtwjhC4l45VhcpintGOmG5e7Ul5zZy7 2N2MA3M2ENyMZqwlVGSCgH8M3/aTZ2PXPGIG+D23764wKLwa51y/HDDBSg2V9yRWhfAI vpEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=3mDAezHxh0iiVnunFtazZae87PNSS0XDfkwX/Cgxz+E=; b=J1hKokQ9g3/1e2fRwbb2yqkdudl5fQ7FtGsy+sl72+oELhXi5lrhUi04QxwulkG+JZ f14mZI3G61D0phiRHE93SOjxPzvTgRiJB2qcqRUtmaQIl6nZ67SDZcEfx5Bwwlt2aQeV lPpHQ/431fIv9Nyu0gHsF0MdQPNp7aRrmYCgBDJhgg/gMGGe5O5OKfBKP7FO4cUOT2TI UP8om1LrWauFF76CBpLrZoioiUiIEd5/ju4fzR5iSv8dZ5BZsH6CMMrzQISdzbyAQvre cdLu3OedlfKNdX5puZspm96kwgf7ZNRTOr737WEqH23jiUfEIPv9RqQcXD9zSD49oSE5 oNUg== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si19854965ede.590.2021.06.01.04.48.12; Tue, 01 Jun 2021 04:48:35 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233815AbhFALqk (ORCPT + 99 others); Tue, 1 Jun 2021 07:46:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233336AbhFALqk (ORCPT ); Tue, 1 Jun 2021 07:46:40 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 543FD61376; Tue, 1 Jun 2021 11:44:59 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lo2pN-004o73-Ei; Tue, 01 Jun 2021 12:44:57 +0100 Date: Tue, 01 Jun 2021 12:44:55 +0100 Message-ID: <87tumh24i0.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: , , , , , Subject: Re: [PATCH stable-5.12.y backport 2/2] KVM: arm64: Resolve all pending PC updates before immediate exit In-Reply-To: <20210601111238.1059-3-yuzenghui@huawei.com> References: <20210601111238.1059-1-yuzenghui@huawei.com> <20210601111238.1059-3-yuzenghui@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: yuzenghui@huawei.com, stable@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, alexandru.elisei@arm.com, wanghaibin.wang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 01 Jun 2021 12:12:38 +0100, Zenghui Yu wrote: > > commit e3e880bb1518eb10a4b4bb4344ed614d6856f190 upstream. > > Commit 26778aaa134a ("KVM: arm64: Commit pending PC adjustemnts before > returning to userspace") fixed the PC updating issue by forcing an explicit > synchronisation of the exception state on vcpu exit to userspace. > > However, we forgot to take into account the case where immediate_exit is > set by userspace and KVM_RUN will exit immediately. Fix it by resolving all > pending PC updates before returning to userspace. > > Since __kvm_adjust_pc() relies on a loaded vcpu context, I moved the > immediate_exit checking right after vcpu_load(). We will get some overhead > if immediate_exit is true (which should hopefully be rare). > > Fixes: 26778aaa134a ("KVM: arm64: Commit pending PC adjustemnts before returning to userspace") > Signed-off-by: Zenghui Yu > Signed-off-by: Marc Zyngier > Link: https://lore.kernel.org/r/20210526141831.1662-1-yuzenghui@huawei.com > Cc: stable@vger.kernel.org # 5.11 Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.