Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1751141ybh; Thu, 23 Jul 2020 17:20:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1XYC4EX6N4LdvQwGAQ3Dk1EPV4WDRn0VQGsFWacCSjh87sRWmOFDeF1wNdp9NMW0lTV7/ X-Received: by 2002:a17:906:c78f:: with SMTP id cw15mr6621451ejb.58.1595550025579; Thu, 23 Jul 2020 17:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595550025; cv=none; d=google.com; s=arc-20160816; b=y2pfeWHuk4MwSuyhMwB2TD7SNLcigZmeSpEg7zj/zRdh/UIeyF5azeqV1ySR0mqjEz RdlxGmJ/LkSsFkFG7zo+x4Hxt/mHcUZuNvTA6z8FIj/P+0IewXHlxR9HsHcq9/7tiX8w 2PjHZuyKOgunylb09cdq6CXqmJAC/L3Y7x81sBkDgCOY4Ec4HOU2gEe7b2WBfqCFiU93 /8CSFgxtTp3ozAfllUofquu5wgFuh43KcLNHuqwrVcCgn97LJNP4qD1X2I9C5wuCoMul 5Ti2L6x9aknj7vJPwct5T0/Psp5/xGNLI5+zj25azGATGwyIoNlOo5t/7j/LQE7jigUT ctIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=rdRzL9lQy2COLIAs7/Wu57811MIkQHqMcBzKtKhZx/U=; b=gqJiZHa47TklYL7xznXYlwfPEDUTyFme7IlcFC+S4AoqUCTneEjtRll7ZvhnWK6xv2 lxYmd/qQKyJ6EIEWKBZEGqQ1qt52Ct+nhnFiGa4flzvfbxrd2GAQAK9KQO5cfuFAZKKt sUaHUWKGJil9CUz7QAPEWeMythS/JdcRLOiE+kZ86Nia6obhmYSnVxdxPM7z4v7ffyKL IghMqxboWfmWj0BhCVP3Ew5jar6+A5RF3hu22ZrqNg6id9efClG7cqQo01cXfHzpcjde Z/Aw27Cct7mtKcFzzHzU403rAdZrs3fn0KrGS1CT1tcMjoxZs4pisBDyeq7jy2+umkbV MNGQ== 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si3014692eju.192.2020.07.23.17.20.03; Thu, 23 Jul 2020 17:20:25 -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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbgGXARh (ORCPT + 99 others); Thu, 23 Jul 2020 20:17:37 -0400 Received: from mga14.intel.com ([192.55.52.115]:40353 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728285AbgGXARh (ORCPT ); Thu, 23 Jul 2020 20:17:37 -0400 IronPort-SDR: MSTgVbt5ad2r6z1M2EuQ9kngtvbHQA3b6Ui02ON3iielnSNC26A0NI6llVRWf7hQ5MZXBTtuRG GNqkpM72l0wA== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="149830200" X-IronPort-AV: E=Sophos;i="5.75,388,1589266800"; d="scan'208";a="149830200" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 17:17:37 -0700 IronPort-SDR: iPXtMmifS+ni/CWHgiVnsagsSt2+a2bKOlh85IU8i4dHH3eHGI9SHAgxCJ2UsNDCusf2OnRU+I ssEpYYD230OA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,388,1589266800"; d="scan'208";a="488556715" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga006.fm.intel.com with ESMTP; 23 Jul 2020 17:17:36 -0700 Date: Thu, 23 Jul 2020 17:17:36 -0700 From: Sean Christopherson To: Thomas Gleixner Cc: LKML , x86@kernel.org, linux-arch@vger.kernel.org, Will Deacon , Arnd Bergmann , Mark Rutland , Kees Cook , Keno Fischer , Paolo Bonzini , kvm@vger.kernel.org, Gabriel Krisman Bertazi Subject: Re: [patch V5 15/15] x86/kvm: Use generic xfer to guest work function Message-ID: <20200724001736.GK21891@linux.intel.com> References: <20200722215954.464281930@linutronix.de> <20200722220520.979724969@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200722220520.979724969@linutronix.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 12:00:09AM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > Use the generic infrastructure to check for and handle pending work before > transitioning into guest mode. > > This now handles TIF_NOTIFY_RESUME as well which was ignored so > far. Handling it is important as this covers task work and task work will > be used to offload the heavy lifting of POSIX CPU timers to thread context. > > Signed-off-by: Thomas Gleixner > --- > V5: Rename exit -> xfer > --- One nit/question below (though it's really about patch 5). Reviewed-and-tested-by: Sean Christopherson > @@ -8676,15 +8677,11 @@ static int vcpu_run(struct kvm_vcpu *vcp > break; > } > > - if (signal_pending(current)) { > - r = -EINTR; > - vcpu->run->exit_reason = KVM_EXIT_INTR; > - ++vcpu->stat.signal_exits; > - break; > - } > - if (need_resched()) { > + if (xfer_to_guest_mode_work_pending()) { > srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); > - cond_resched(); > + r = xfer_to_guest_mode(vcpu); Any reason not to call this xfer_to_guest_mode_work()? Or handle_work(), do_work(), etc... Without the "work" part, it looks like a function that should be invoked unconditionally. It's obvious that's not the case if one looks at the implementation, but it's a bit confusing on the KVM side of things. > + if (r) > + return r; > vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); > } > } >