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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97AD4C433B4 for ; Mon, 17 May 2021 18:05:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C4F161166 for ; Mon, 17 May 2021 18:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241316AbhEQSGS (ORCPT ); Mon, 17 May 2021 14:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236781AbhEQSGR (ORCPT ); Mon, 17 May 2021 14:06:17 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2531C061756 for ; Mon, 17 May 2021 11:05:00 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id k19so5515355pfu.5 for ; Mon, 17 May 2021 11:05:00 -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=RK9CKsxYiZ0SKcAPJMjkDQ9/exTOSP2ko5N4Ci6GuXs=; b=LSaIZZlsx3p9ej1B86/ciNnrvYc8952OFvB5rJLgzDWArbdNp7pJvfg3PGluQUAgUu fsovaLGtnPco/Y6H4PoNWmd6Jip2Ipp/eMy91HQAhHrUQhhg1R3giyX+8v1bmTCfue6S M5Wi7U4j4xv//BZj/r9x5A57SzVUUGr8aAPyZcOnHnd5AsLLtYgMa4j7mhAMXbZ8IWdJ LZkw+RyAMRe/0NGmrBQOyRrtbIrFwWOwGiu0gnTV1FdXG3BEtqGUd575jX8dj/w/7yXY LeMc9aOJYHIZ8Zlw/TwwMWBKMbkih0xiE3/wCFspJPArkT8JoUDBFgpWMaJIEtJZDzR7 t4fQ== 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=RK9CKsxYiZ0SKcAPJMjkDQ9/exTOSP2ko5N4Ci6GuXs=; b=UB3SiTvAcUARh5vKuaxtxJHQjd0eapYwX05OMlRbPtkcIKVSaAELtpX8OkJ1m1yan7 EMymdagtfz9jvathH4NPF6wUEbN2qXbp1vtgY2B5qvWs2tkkUBelHwLY232IP6tWb7pA VVNb46rSYyRMQUp238vgem9wvR+Mo2n46yEfkzn83VawQdVi/0XaSJIlUuS30YCnqMsf QMmZ2fZCAmln94AVef7GM0FOWdbNsW3SIFzGrzmDz38LTGrkrRaQTODtn51pOVbjlU+C o8Y9IYluWp4UIiPofiWoI3sVAgkJUuCA/lG0dXAxgPpBYOdoQdEx5FhCKvJjU1xpJ/SI lvCA== X-Gm-Message-State: AOAM532IxcOyHNGF8kIeYK3VrCSsuhEUPkilvARig5OmH77QhJ2LLV/M oXygHc5uLFXmazP1GXiSgqNPww== X-Google-Smtp-Source: ABdhPJwrHdcqHaaCzqnkXKeuTTo/NFeQCxMKnHCAmext9WOsmA4UolhzEow6UhPiLLfsr6hujFEtrg== X-Received: by 2002:a65:6183:: with SMTP id c3mr715412pgv.403.1621274700186; Mon, 17 May 2021 11:05:00 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id x184sm11459121pgb.36.2021.05.17.11.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 11:04:59 -0700 (PDT) Date: Mon, 17 May 2021 18:04:56 +0000 From: Sean Christopherson To: Dave Hansen Cc: Andy Lutomirski , Paolo Bonzini , Jon Kohler , Babu Moger , Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , "H. Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Fenghua Yu , Yu-cheng Yu , Tony Luck , Uros Bizjak , Petteri Aimonen , Kan Liang , Andrew Morton , Mike Rapoport , Benjamin Thiel , Fan Yang , Juergen Gross , Dave Jiang , "Peter Zijlstra (Intel)" , Ricardo Neri , Arvind Sankar , Linux Kernel Mailing List , kvm list Subject: Re: [PATCH] KVM: x86: add hint to skip hidden rdpkru under kvm_load_host_xsave_state Message-ID: References: <20210507164456.1033-1-jon@nutanix.com> <5e01d18b-123c-b91f-c7b4-7ec583dd1ec6@redhat.com> <4e6f7056-6b66-46b9-9eac-922ae1c7b526@www.fastmail.com> <342a8ba9-037e-b841-f9b1-cb62e46c0db8@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <342a8ba9-037e-b841-f9b1-cb62e46c0db8@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 17, 2021, Dave Hansen wrote: > On 5/17/21 10:49 AM, Andy Lutomirski wrote: > >> The least awful solution would be to have the NMI handler restore > >> the host's PKRU. The NMI handler would need to save/restore the > >> register, a la CR2, but the whole thing could be optimized to run > >> if and only if the NMI lands in the window where the guest's PKRU > >> is loaded. > > > > Or set a flag causing nmi_uaccess_ok() to return false. > > Oh, that doesn't sound too bad. The VMENTER/EXIT paths are also > essentially a context switch. I like that idea, too. The flag might also be useful to fix the issue where the NMI handler activates PEBS after KVM disables it. Jim? > Will widening the window where nmi_uaccess_okay()==false anger any of > the perf folks? It looks like perf knows how to handle it nicely.