Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752022AbbFRFGl (ORCPT ); Thu, 18 Jun 2015 01:06:41 -0400 Received: from mga01.intel.com ([192.55.52.88]:40236 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751309AbbFRFGd (ORCPT ); Thu, 18 Jun 2015 01:06:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,637,1427785200"; d="scan'208";a="510162179" Message-ID: <558250D4.3050505@linux.intel.com> Date: Thu, 18 Jun 2015 13:02:12 +0800 From: Xiao Guangrong User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org CC: rkrcmar@redhat.com, bdas@redhat.com Subject: Re: [PATCH v2 12/13] KVM: x86: add SMM to the MMU role, support SMRAM address space References: <1432746314-50196-1-git-send-email-pbonzini@redhat.com> <1432746314-50196-13-git-send-email-pbonzini@redhat.com> <55766510.7010108@linux.intel.com> <55812D4F.10506@redhat.com> In-Reply-To: <55812D4F.10506@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1598 Lines: 47 On 06/17/2015 04:18 PM, Paolo Bonzini wrote: > > > On 09/06/2015 06:01, Xiao Guangrong wrote: >> >> >> On 05/28/2015 01:05 AM, Paolo Bonzini wrote: >>> This is now very simple to do. The only interesting part is a simple >>> trick to find the right memslot in gfn_to_rmap, retrieving the address >>> space from the spte role word. The same trick is used in the auditing >>> code. >>> >>> The comment on top of union kvm_mmu_page_role has been stale forever, >> >> Fortunately, we have documented these fields in mmu.txt, please do it for >> 'smm' as well. :) > > Right, done. > >>> + /* >>> + * This is left at the top of the word so that >>> + * kvm_memslots_for_spte_role can extract it with a >>> + * simple shift. While there is room, give it a whole >>> + * byte so it is also faster to load it from memory. >>> + */ >>> + unsigned smm:8; >> >> I suspect if we really need this trick, smm is not the hottest filed in >> this struct anyway. > > Note that after these patches it is used by gfn_to_rmap, and hence for > example rmap_add. However, role->level is more hotter than role->smm so that it's also a good candidate for this kind of trick. And this is only 32 bits which can be operated in a CPU register by a single memory load, that is why i was worried if it is really needed. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/