Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935445AbdLRQDF (ORCPT ); Mon, 18 Dec 2017 11:03:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42846 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935429AbdLRQDC (ORCPT ); Mon, 18 Dec 2017 11:03:02 -0500 Date: Mon, 18 Dec 2017 11:03:02 -0500 (EST) From: Paolo Bonzini To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, bsd@redhat.com, jmattson@google.com Message-ID: <854645993.27733836.1513612982078.JavaMail.zimbra@redhat.com> In-Reply-To: References: <1513171828-5130-1-git-send-email-pbonzini@redhat.com> Subject: Re: [PATCH] KVM: vmx: speed up MSR bitmap merge MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [78.12.251.125, 10.4.196.7, 10.4.195.23] Thread-Topic: speed up MSR bitmap merge Thread-Index: PimRGSYX7OtHXQDnWH0juIrr4G5Xkw== X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 18 Dec 2017 16:03:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 758 Lines: 23 > > - memset(msr_bitmap_l0, 0xff, PAGE_SIZE); > > + msr_bitmap_l1 = (unsigned long *)kmap(page); > > Wouldn't it be easier to simply set everything to 0xff as before and > then only handle the one special case where you don't do that? e.g. the > complete else part would be gone. It can change from one vmentry to the next, so I'm not sure how you'd do that. > > + nested_vmx_disable_intercept_for_msr( > > + msr_bitmap_l1, msr_bitmap_l0, > > + APIC_BASE_MSR + (APIC_TASKPRI >> 4), > > + MSR_TYPE_W); > > I'd vote for indenting the parameters properly (even though we exceed 80 > chars by 1 then :) ) Ok, will do. Regarding the WARN, I'm undecided. I like the idea of not calling a function that works on MSR bitmaps unless you have one... Paolo