From mboxrd@z Thu Jan 1 00:00:00 1970 From: Denys Vlasenko Subject: Re: [PATCH] x86: Use entire page for the per-cpu GDT only if paravirt-enabled Date: Sat, 26 Sep 2015 22:38:25 +0200 Message-ID: <56070241.2030407@redhat.com> References: <1443290440-14930-1-git-send-email-dvlasenk@redhat.com> <706E9982-24E3-442B-808A-172909449DD4@zytor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Konrad Rzeszutek Wilk , Boris Ostrovsky , David Vrabel , Joerg Roedel , Gleb Natapov , Paolo Bonzini , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org To: "H. Peter Anvin" , Ingo Molnar Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33907 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753664AbbIZUi3 (ORCPT ); Sat, 26 Sep 2015 16:38:29 -0400 In-Reply-To: <706E9982-24E3-442B-808A-172909449DD4@zytor.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/26/2015 09:50 PM, H. Peter Anvin wrote: > NAK. We really should map the GDT read-only on all 64 bit systems, > since we can't hide the address from SLDT. Same with the IDT. Sorry, I don't understand your point. > On September 26, 2015 11:00:40 AM PDT, Denys Vlasenko wrote: >> We have our GDT in a page-sized per-cpu structure, gdt_page. >> >> On x86_64 kernel, GDT is 128 bytes - only ~3% of that page is used. >> >> It is page-sized because of paravirt. Hypervisors need to know when >> GDT is changed, so they remap it read-only and handle write faults. >> If it's not in its own page, other writes nearby will cause >> those faults too. >> >> In other words, we need GDT to live in a separate page >> only if CONFIG_HYPERVISOR_GUEST=y. >> >> This patch reduces GDT alignment to cacheline-aligned >> if CONFIG_HYPERVISOR_GUEST is not set. >> >> Patch also renames gdt_page to cpu_gdt (mimicking naming of existing >> cpu_tss per-cpu variable), since now it is not always a full page.