From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbdBTRvx (ORCPT ); Mon, 20 Feb 2017 12:51:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38484 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752319AbdBTRvv (ORCPT ); Mon, 20 Feb 2017 12:51:51 -0500 Subject: Re: [PATCH 6/6] x86/kvm/vmx: Defer TR reload after VM exit To: Andy Lutomirski , X86 ML References: Cc: kvm list , "linux-kernel@vger.kernel.org" , Borislav Petkov , Thomas Garnier , Jim Mattson From: Paolo Bonzini Message-ID: <0b68496d-1d75-d358-c94f-62f534ee342d@redhat.com> Date: Mon, 20 Feb 2017 18:51:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 20 Feb 2017 17:51:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/02/2017 17:56, Andy Lutomirski wrote: > +{ > + DEBUG_LOCKS_WARN_ON(preemptible()); > + > + if (unlikely(this_cpu_read(need_tr_refresh))) { > + force_reload_TR(); > + this_cpu_write(need_tr_refresh, false); > + } > +} > + > +/* > + * If you do something evil that corrupts the cached TSS limit (I'm looking > + * at you, VMX exits), call this function. > + * > + * The optimization here is that the TSS limit only matters for Linux if the > + * IO bitmap is in use. If the TSS limit gets forced to its minimum value, > + * everything works except that IO bitmap will be ignored and all CPL 3 IO > + * instructions will #GP, which is exactly what we want for normal tasks. > + */ > +static inline void invalidate_tss_limit(void) > +{ > + DEBUG_LOCKS_WARN_ON(preemptible()); > + > + if (unlikely(test_thread_flag(TIF_IO_BITMAP))) > + refresh_TR(); This must be force_reload_TR, not refresh_TR. Paolo > + else > + this_cpu_write(need_tr_refresh, true);