Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp640418ybz; Wed, 15 Apr 2020 15:44:37 -0700 (PDT) X-Google-Smtp-Source: APiQypJFK+qEI513sbvIvsqoyzY5x3fD8uLjWHpb0apNmHjQHAB4U23csZ3yx+L4oS/d4v2CGG38 X-Received: by 2002:a17:906:1e48:: with SMTP id i8mr7286300ejj.232.1586990676911; Wed, 15 Apr 2020 15:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586990676; cv=none; d=google.com; s=arc-20160816; b=O5V9cPytxhbVkJjnkxzkzpzNiKaWoYBaYBj1087KGVBlM6TLZ8QDcLsy3st1Lcggd+ IfypEjHG0Aj6DdrJzVKTtD/xIAvJVHQezlJ8EbAYTpGW+rKs0BgIUcq6vgW1C/jBUX6u lP2j/udHRRLs+c6Unu9ZWYn6klDeuci6epS0NRdHX4y2LVz7PXA2zLhWuCtuWtT8+1Pa Kht3plbtIhiMf9MfX9G2PXy0qmgG7eYDLbywwqMlE9oRLuaigXVyiu6oYNW8/3N60U7V wJC5cBpK98481ApGjgE1FYVts+sGouniP2skE5hwMnPe9ITWhqVEumugEPlRlwFnJueT jVcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=lisOMIPYzGEOUKW/w9q538cTmyUuHd07/Sojgyr8MlQ=; b=uOhN+8/xqOH7cf5Mu0YSYs0u0YzFV+xcqnJdRUboZ0b3zaEcESpgWtBcutmcN8jSaJ C6+umHbF2odWXCR58GBXJ5EPjRibI/TF/O5NzRyJV8O1K/OC+Va9/TMMmECVyGg4BR54 PKA8WbkirP2ZV9Ug5QR57fa1lxFNPGBOV+SKIsgZbvNEBzWkHUVoBQbtdrWGG729PbFc m9Fh+FzaNCpKrPW0VHuDaYtV1YIvahMnAlzi1qGORQnyHJBZNo6xVM4XX/WwAGxN6GLT uhcTskuiIx2qU2ZoklHurXr49/cqTY4srjg2bwnu3iez+IkSsAzYsygNjoc8mcch60BP 4nCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jx2FDyTW; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si11212847ejr.86.2020.04.15.15.44.13; Wed, 15 Apr 2020 15:44:36 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jx2FDyTW; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408286AbgDOJII (ORCPT + 99 others); Wed, 15 Apr 2020 05:08:08 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22374 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2408269AbgDOJIA (ORCPT ); Wed, 15 Apr 2020 05:08:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586941679; 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: in-reply-to:in-reply-to:references:references; bh=lisOMIPYzGEOUKW/w9q538cTmyUuHd07/Sojgyr8MlQ=; b=Jx2FDyTWiVDSj+TGOWOlb6Tpt+VTUEEy0yd9fpRMKl7rQKOY871ngDkQGOjhAC8N+d7SY0 Bs4Q8EQdCr8SzcYu4yqzOh5h22g90k72oCAFQQ0KvtupPEZo/SY0pBdzJTkbeMQmNX+mlb qi4WIYZbc8j89wpMCMzWuylFT++B45o= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-215-rIEPXwd8Nc-T0FjIs46uOw-1; Wed, 15 Apr 2020 05:07:57 -0400 X-MC-Unique: rIEPXwd8Nc-T0FjIs46uOw-1 Received: by mail-wm1-f70.google.com with SMTP id h184so1896162wmf.5 for ; Wed, 15 Apr 2020 02:07:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=lisOMIPYzGEOUKW/w9q538cTmyUuHd07/Sojgyr8MlQ=; b=ANaGpkGukQskXo2Dfqa6PT+49hcz5Qe526yTFpDEFNGgbN3WAGHN7COFSDYj/BBOsf hK2jDpm2HJJG4eGSM2wrScYAhONti6y1RjR3HlmfqpkyUQMgMcLcRSXTb9Yo5iRFhNVq jc9d8S8Qcs5LJrSp8lud9tfrlFQAOElD9T6WCMcMJYiuIn4syIKtooXfeOHPpnFJSHxy /kj8aPS/lKI2ZkzCyvmzFpoySnynHmCXbkOUpdZxL3mxr3H6yi0kdHVZocfE8ilCSs3j uxn0COZKJOmqx1uqa9oECIhMubBRjWAr7gKBIWiED98pbSG9elJAeiCrxF364BGNnZvp N52Q== X-Gm-Message-State: AGi0PuaNdih1fPVJKRJ7+gOxfljp9POyddKY+g+WIdVlQO6PyOQhqgr9 NWdM1VobpQq45v0/HVbJBbnhx2K9GKlZkRCtib3dqrKQGO+T6x1UVEnWW2kb7GkCLIG5e4a4EL0 jlVNPDOay/bk9CZ1WXhfEQfzM X-Received: by 2002:a5d:6841:: with SMTP id o1mr27977386wrw.412.1586941676332; Wed, 15 Apr 2020 02:07:56 -0700 (PDT) X-Received: by 2002:a5d:6841:: with SMTP id o1mr27977353wrw.412.1586941676047; Wed, 15 Apr 2020 02:07:56 -0700 (PDT) Received: from vitty.brq.redhat.com (g-server-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id e5sm23214697wru.92.2020.04.15.02.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 02:07:55 -0700 (PDT) From: Vitaly Kuznetsov To: Tianjia Zhang Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, pbonzini@redhat.com, sean.j.christopherson@intel.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Subject: Re: [PATCH] KVM: Optimize kvm_arch_vcpu_ioctl_run function In-Reply-To: References: <20200413034523.110548-1-tianjia.zhang@linux.alibaba.com> <875ze2ywhy.fsf@vitty.brq.redhat.com> Date: Wed, 15 Apr 2020 11:07:53 +0200 Message-ID: <87a73dxgk6.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tianjia Zhang writes: > On 2020/4/14 22:26, Vitaly Kuznetsov wrote: >> Tianjia Zhang writes: >> >>> kvm_arch_vcpu_ioctl_run() is only called in the file kvm_main.c, >>> where vcpu->run is the kvm_run parameter, so it has been replaced. >>> >>> Signed-off-by: Tianjia Zhang >>> --- >>> arch/x86/kvm/x86.c | 8 ++++---- >>> virt/kvm/arm/arm.c | 2 +- >>> 2 files changed, 5 insertions(+), 5 deletions(-) >>> >>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >>> index 3bf2ecafd027..70e3f4abbd4d 100644 >>> --- a/arch/x86/kvm/x86.c >>> +++ b/arch/x86/kvm/x86.c >>> @@ -8726,18 +8726,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) >>> r = -EAGAIN; >>> if (signal_pending(current)) { >>> r = -EINTR; >>> - vcpu->run->exit_reason = KVM_EXIT_INTR; >>> + kvm_run->exit_reason = KVM_EXIT_INTR; >> >> I have a more generic question: why do we need to pass 'kvm_run' to >> kvm_arch_vcpu_ioctl_run() if it can be extracted from 'struct kvm_vcpu'? >> The only call site looks like >> >> virt/kvm/kvm_main.c: r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run); >> > > In the earlier version, kvm_run is used to pass parameters with user > mode and is not included in the vcpu structure, so it has been retained > until now. > In case this is no longer needed I'd suggest we drop 'kvm_run' parameter and extract it from 'struct kvm_vcpu' when needed. This looks like a natural add-on to your cleanup patch. -- Vitaly