From: Paolo Bonzini Subject: Re: [PATCH 1/4] kvm: nVMX: Add support for "VMWRITE to any supported field" Date: Fri, 7 Jul 2017 18:00:24 -0400 (EDT) Message-ID: <545547542.14730974.1499464824148.JavaMail.zimbra@redhat.com> References: <20170706195218.98520-1-jmattson@google.com> <20170706195218.98520-2-jmattson@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm list , David Matlack To: Jim Mattson Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42170 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbdGGWAZ (ORCPT ); Fri, 7 Jul 2017 18:00:25 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: > > After your changes here, vmx_vmread_bitmap and vmx_vmwrite_bitmap have > > always the same content. Instead, it should be possible for the read > > and write bitmap to point to the same address. > > Yes, but copy_shadow_to_vmcs12() also needs to walk the "read-only" fields when > they are read/write. Dealing with the two arrays of indices is awkward. It's just the code that's already in copy_vmcs12_to_shadow. If you first introduce vmcs_read/write_any, the two nested for loops aren't bad. Or, make the "for (i = 0; i < num_fields; i++)" loop its own function, like copy_vmcs12_fields_to_shadow and copy_shadow_fields_to_vmcs12, and call it twice. Paolo