Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp541086pxb; Thu, 2 Sep 2021 09:34:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWb0Xj9mwskZ/ZUKN4NReSmAm1f0rSwDl47sfYLIvvifUvjgG5OGgncYK/62AnGc+T9bBL X-Received: by 2002:aa7:c311:: with SMTP id l17mr4318618edq.320.1630600468038; Thu, 02 Sep 2021 09:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630600468; cv=none; d=google.com; s=arc-20160816; b=REK1zmxJtwjfXuvTu38wA6ACfvmr1KaHt44c6EEWTNEb7GJXauigEbkve6cfD/jOqC tJVoMVnG9BPuHAyv2waQuB/08nPTzn9AvaXJwslW1PeKXPsTfAJZ6G+WaE8inDrxr9GY Lt9JgQ5qPfxBpUqbWbeGCuSCK5ZLak1EvF0xU4xKEIG72f2E0qHiJPgskRhQX3iYMtmA 1eL4ArAdXbuO04Is1Qbj81oWDQBWq6+1zy3EtF1rWfiaa9cbKxjseUkDs0iNbYmdAnEQ QHO8mIFnVfQHKn3yxIu+M8Z2dbhLFHZyWQMQS85HS1c8jJkr+WsG6bS+TcGuq3tD4Anx u2Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g7rNCRYI4FVtRdLWcxPgYOxxATANuLmHX5p0OHhQ/OQ=; b=lIF5BSuXcL96XIPAbIlBLYTTC89h8ID0j8yTUgg1vIzq9YyfD+yRT5G6c65ZNXh2Az oB0vfUXRA8iZkowyztIc9WJdrRXGcavpClALnVPcuFHsRaub2IGy7pK3d7lfdYeV4kIb IFRASogVnb2pdQd5yyiYDE9whwHNMMCGKrMSfDIcHi8IZSQGA2QWDKiclna1VWOdC+qO vmXs3yfewxTL2viLwGJObVlLz6Tg7nuGFCbd9IHk0BrYfJOCY+nyT+DXOoettiEAfgFd 19xdENLgE3vL5H/PeP674MKU9LB2H4MoCv/zsCAKeb4yVJmMNWGh+sjOaXTEa5Y5kilT 9FUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=e3awIW1z; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si2234279ejm.60.2021.09.02.09.33.42; Thu, 02 Sep 2021 09:34:28 -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=@google.com header.s=20161025 header.b=e3awIW1z; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346305AbhIBQau (ORCPT + 99 others); Thu, 2 Sep 2021 12:30:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235316AbhIBQat (ORCPT ); Thu, 2 Sep 2021 12:30:49 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E01FC061575 for ; Thu, 2 Sep 2021 09:29:51 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id w7so2504856pgk.13 for ; Thu, 02 Sep 2021 09:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=g7rNCRYI4FVtRdLWcxPgYOxxATANuLmHX5p0OHhQ/OQ=; b=e3awIW1zIGCxTic+i6+lboTIlwUoY/CE6fjKlEcBGAvlSXQ2NkpAyDAw6W2E0uHp2L xzWL8JbP4vpFgizBQTrlJ+CpT9kmhxkrd1clie/oJm/r2J8t3SJ4mzZvR7A7TMmvZD7/ TNcx8f+k/skk/Af98c9JjoT65hCMkEz6K5ADL1vdk+DdF35xKaWh36kQsj60l0Oat4Av ntkPHMkeoUm3mBKVe9ynsvU19hXytkI5BsE4KIskCpfG8+JV3PvgP+FmdvYT+u71BUbB XowX3ZIgiSVQUO3yzgC+rh4Re+sDCxJjLP11qlMtwnK9RIYjJfg1Z1xYf56hwzSQG7AD nxOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=g7rNCRYI4FVtRdLWcxPgYOxxATANuLmHX5p0OHhQ/OQ=; b=BgUGgn/pUQlqQKlqE8HGLLxfFEj0HmHPqwhfI5SQQy8+zu45RPN0Egi7/3l1ANPCva P/CCUf3y56xPw4WAqDd/uNWfQZyBBAkq8qQk10TVGgKzgxbYZzztJrOCyZOuOzBPLCwx FzGLPLKdaCticy5m3hysHjYUaxbeDwCGnLBu2+9028CSAXy7fJVtxq4Vd8mlyyprMaa9 bchkAiSdspElcbUiCPTtoxK/GSUVBhROHUfn63jh2lsidhofjZOvIitZwVJGMJboOUw1 Z0KBwomLZHRrBwhaXzKqjigrojan/6cwrsmEBCBAiBpuxVcUd3WQUgoR3vPOn+sLAlfn M/rQ== X-Gm-Message-State: AOAM531flf2cguSYF4xeOfW5vrXgxjvEHbUptzyllL5lVBdKyvxMLQnw eeCbdCHAgPQ/q8s3Yx6a8JrDGQ== X-Received: by 2002:a63:f154:: with SMTP id o20mr4113169pgk.298.1630600190841; Thu, 02 Sep 2021 09:29:50 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id v25sm2770900pfm.202.2021.09.02.09.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 09:29:50 -0700 (PDT) Date: Thu, 2 Sep 2021 16:29:46 +0000 From: Sean Christopherson To: Chenyi Qiang Cc: Xiaoyao Li , Tao Xu , pbonzini@redhat.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] KVM: VMX: Enable Notify VM exit Message-ID: References: <20210525051204.1480610-1-tao3.xu@intel.com> <080602dc-f998-ec13-ddf9-42902aa477de@intel.com> <4079f0c9-e34c-c034-853a-b26908a58182@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4079f0c9-e34c-c034-853a-b26908a58182@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021, Chenyi Qiang wrote: > On 8/3/2021 8:38 AM, Xiaoyao Li wrote: > > On 8/2/2021 11:46 PM, Sean Christopherson wrote: > > > IIRC, SGX instructions have a hard upper bound of 25k cycles before they > > > have to check for pending interrupts, e.g. it's why EINIT is > > > interruptible. The 25k cycle limit is likely a good starting point for > > > the combined minimum. That's why I want to know the internal minimum; if > > > the internal minimum is _guaranteed_ to be >25k, then KVM can be more > > > aggressive with its default value. > > > > OK. I will go internally to see if we can publish the internal threshold. > > > > Hi Sean, > > After syncing internally, we know that the internal threshold is not > architectural but a model-specific value. It will be published in some place > in future. Any chance it will also be discoverable, e.g. via an MSR? That would be ideal as we could give the module param an "auto" mode where the combined threshold is set to a minimum KVM-defined value, e.g. static int __read_mostly notify_window = -1; module_param(notify_window, int, 444); ... rdmsrl_safe(MSR_NOTIFY_WINDOW_BUFFER, &buffer); if (notify_window == -1) { if (buffer < KVM_DEFAULT_NOTIFY_WINDOW) notify_window = 0; else notifiy_window = KVM_DEFAULT_NOTIFY_WINDOW - buffer; } > On Sapphire Rapids platform, the threshold is 128k. With this in mind, is it > appropriate to set 0 as the default value of notify_window? Maybe? That's still not a guarantee that _future_ CPUs will have an internal threshold >25k. On a related topic, this needs tests. One thought would be to stop unconditionally intercepting #AC if NOTIFY_WINDOW is enabled, and then have the test set up the infinite #AC vectoring scenario.