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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C397DC433F5 for ; Sat, 16 Oct 2021 10:50:05 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 344F5611C3 for ; Sat, 16 Oct 2021 10:50:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 344F5611C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A8BE34B152; Sat, 16 Oct 2021 06:50:04 -0400 (EDT) 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 p9t2uFu6lRqB; Sat, 16 Oct 2021 06:50:03 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6A7A84B154; Sat, 16 Oct 2021 06:50:03 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0CCA34B152 for ; Sat, 16 Oct 2021 06:50:02 -0400 (EDT) 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 ADpWJQp+v2qV for ; Sat, 16 Oct 2021 06:50:01 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 054CB4B0D7 for ; Sat, 16 Oct 2021 06:50:01 -0400 (EDT) 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 06CC1611C1; Sat, 16 Oct 2021 10:50:00 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.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 1mbhGH-00HBKp-Pv; Sat, 16 Oct 2021 11:49:57 +0100 Date: Sat, 16 Oct 2021 11:49:57 +0100 Message-ID: <87k0idutuy.wl-maz@kernel.org> From: Marc Zyngier To: Andrew Jones Subject: Re: [PATCH 0/5] KVM: arm64: Reorganise vcpu first run In-Reply-To: <20211015100548.4yd2ukon5rypexoo@gator> References: <20211015090822.2994920-1-maz@kernel.org> <20211015094900.pl2gyysitpnszojy@gator> <20211015100548.4yd2ukon5rypexoo@gator> 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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: drjones@redhat.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, will@kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, Will Deacon , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.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 On Fri, 15 Oct 2021 11:05:48 +0100, Andrew Jones wrote: > > On Fri, Oct 15, 2021 at 11:49:00AM +0200, Andrew Jones wrote: > > On Fri, Oct 15, 2021 at 10:08:17AM +0100, Marc Zyngier wrote: > > > KVM/arm64 relies heavily on a bunch of things to be done on the first > > > run of the vcpu. We also do a bunch of things on PID change. It turns > > > out that these two things are pretty similar (the first PID change is > > > also the first run). > > > > > > This small series aims at simplifying all that, and to get rid of the > > > vcpu->arch.has_run_once state. > > > > > > Marc Zyngier (5): > > > KVM: arm64: Move SVE state mapping at HYP to finalize-time > > > KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line > > > KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and > > > kvm_vcpu_first_run_init() > > > KVM: arm64: Restructure the point where has_run_once is advertised > > > > Maybe do the restructuring before the merging in order to avoid the > > potential for bizarre states? Yup, can do. > > Also, before we do the merge I think we need to duplicate the > > if (unlikely(!kvm_vcpu_initialized(vcpu))) > return -ENOEXEC; > > that we currently have above the call of kvm_vcpu_first_run_init() > into kvm_arch_vcpu_run_pid_change() because > kvm_arch_vcpu_run_pid_change() is called before kvm_arch_vcpu_ioctl_run() > in KVM_RUN. Well spotted. I think this check should be moved into kvm_arch_vcpu_run_pid_change() instead of duplicated though, just like we have the check for 'finalized' there. After all, they are the two sides of the same coin. This nicely moves all checks on the slow path. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1074C433F5 for ; Sat, 16 Oct 2021 10:51:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6054660F56 for ; Sat, 16 Oct 2021 10:51:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6054660F56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fmwlTwYRnJMJuTvd0Xo/s7+alUdhQfm8Gaqu7BJUieA=; b=AQ8UUsD+YfWNXW nyTBDvD5ZATJz4AL2Lcu1KVkX6VwCqBiehXLnCvAa9weWdJQF1UgCTBcP/e3sgiZI5gJpvhz/j/Su GZiIY/5I4dAG0PzoRc/3dOt9+0iWBwjWuGGJnnxWzF5gW17F0JHMgezX23EW/T1wxlajsGEXEClhf 2rVb9r59OjPzi1u5iK53s0In9A+Ue+GonlqitWHTwnc8GA8BDJzfpA5c6Nf/kTP30ohA35MojpFfQ bszziBsJB0LlU6VQ/gyG6po/qvvGHsTFqWcedMjagfWW5j1RkH3sXpvFpj0zqN/sp25gc0YILfcZi oxi72ZtDtwFSU8SUrTng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbhGO-00ANhW-Se; Sat, 16 Oct 2021 10:50:05 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbhGK-00ANgq-S2 for linux-arm-kernel@lists.infradead.org; Sat, 16 Oct 2021 10:50:02 +0000 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 06CC1611C1; Sat, 16 Oct 2021 10:50:00 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.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 1mbhGH-00HBKp-Pv; Sat, 16 Oct 2021 11:49:57 +0100 Date: Sat, 16 Oct 2021 11:49:57 +0100 Message-ID: <87k0idutuy.wl-maz@kernel.org> From: Marc Zyngier To: Andrew Jones Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Will Deacon , kernel-team@android.com Subject: Re: [PATCH 0/5] KVM: arm64: Reorganise vcpu first run In-Reply-To: <20211015100548.4yd2ukon5rypexoo@gator> References: <20211015090822.2994920-1-maz@kernel.org> <20211015094900.pl2gyysitpnszojy@gator> <20211015100548.4yd2ukon5rypexoo@gator> 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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: drjones@redhat.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, will@kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211016_035000_953571_5E8E67A3 X-CRM114-Status: GOOD ( 25.84 ) 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, 15 Oct 2021 11:05:48 +0100, Andrew Jones wrote: > > On Fri, Oct 15, 2021 at 11:49:00AM +0200, Andrew Jones wrote: > > On Fri, Oct 15, 2021 at 10:08:17AM +0100, Marc Zyngier wrote: > > > KVM/arm64 relies heavily on a bunch of things to be done on the first > > > run of the vcpu. We also do a bunch of things on PID change. It turns > > > out that these two things are pretty similar (the first PID change is > > > also the first run). > > > > > > This small series aims at simplifying all that, and to get rid of the > > > vcpu->arch.has_run_once state. > > > > > > Marc Zyngier (5): > > > KVM: arm64: Move SVE state mapping at HYP to finalize-time > > > KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line > > > KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and > > > kvm_vcpu_first_run_init() > > > KVM: arm64: Restructure the point where has_run_once is advertised > > > > Maybe do the restructuring before the merging in order to avoid the > > potential for bizarre states? Yup, can do. > > Also, before we do the merge I think we need to duplicate the > > if (unlikely(!kvm_vcpu_initialized(vcpu))) > return -ENOEXEC; > > that we currently have above the call of kvm_vcpu_first_run_init() > into kvm_arch_vcpu_run_pid_change() because > kvm_arch_vcpu_run_pid_change() is called before kvm_arch_vcpu_ioctl_run() > in KVM_RUN. Well spotted. I think this check should be moved into kvm_arch_vcpu_run_pid_change() instead of duplicated though, just like we have the check for 'finalized' there. After all, they are the two sides of the same coin. This nicely moves all checks on the slow path. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1E64C433F5 for ; Sat, 16 Oct 2021 10:50:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9B84611C1 for ; Sat, 16 Oct 2021 10:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240267AbhJPKwI (ORCPT ); Sat, 16 Oct 2021 06:52:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:58384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240224AbhJPKwH (ORCPT ); Sat, 16 Oct 2021 06:52:07 -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 06CC1611C1; Sat, 16 Oct 2021 10:50:00 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.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 1mbhGH-00HBKp-Pv; Sat, 16 Oct 2021 11:49:57 +0100 Date: Sat, 16 Oct 2021 11:49:57 +0100 Message-ID: <87k0idutuy.wl-maz@kernel.org> From: Marc Zyngier To: Andrew Jones Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Will Deacon , kernel-team@android.com Subject: Re: [PATCH 0/5] KVM: arm64: Reorganise vcpu first run In-Reply-To: <20211015100548.4yd2ukon5rypexoo@gator> References: <20211015090822.2994920-1-maz@kernel.org> <20211015094900.pl2gyysitpnszojy@gator> <20211015100548.4yd2ukon5rypexoo@gator> 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: 185.219.108.64 X-SA-Exim-Rcpt-To: drjones@redhat.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, will@kernel.org, kernel-team@android.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: kvm@vger.kernel.org On Fri, 15 Oct 2021 11:05:48 +0100, Andrew Jones wrote: > > On Fri, Oct 15, 2021 at 11:49:00AM +0200, Andrew Jones wrote: > > On Fri, Oct 15, 2021 at 10:08:17AM +0100, Marc Zyngier wrote: > > > KVM/arm64 relies heavily on a bunch of things to be done on the first > > > run of the vcpu. We also do a bunch of things on PID change. It turns > > > out that these two things are pretty similar (the first PID change is > > > also the first run). > > > > > > This small series aims at simplifying all that, and to get rid of the > > > vcpu->arch.has_run_once state. > > > > > > Marc Zyngier (5): > > > KVM: arm64: Move SVE state mapping at HYP to finalize-time > > > KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line > > > KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and > > > kvm_vcpu_first_run_init() > > > KVM: arm64: Restructure the point where has_run_once is advertised > > > > Maybe do the restructuring before the merging in order to avoid the > > potential for bizarre states? Yup, can do. > > Also, before we do the merge I think we need to duplicate the > > if (unlikely(!kvm_vcpu_initialized(vcpu))) > return -ENOEXEC; > > that we currently have above the call of kvm_vcpu_first_run_init() > into kvm_arch_vcpu_run_pid_change() because > kvm_arch_vcpu_run_pid_change() is called before kvm_arch_vcpu_ioctl_run() > in KVM_RUN. Well spotted. I think this check should be moved into kvm_arch_vcpu_run_pid_change() instead of duplicated though, just like we have the check for 'finalized' there. After all, they are the two sides of the same coin. This nicely moves all checks on the slow path. Thanks, M. -- Without deviation from the norm, progress is not possible.