lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100226122502.GC12689@amd.com>
Date:	Fri, 26 Feb 2010 13:25:02 +0100
From:	Joerg Roedel <joerg.roedel@....com>
To:	Avi Kivity <avi@...hat.com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	Alexander Graf <agraf@...e.de>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] KVM: SVM: Optimize nested svm msrpm merging

On Fri, Feb 26, 2010 at 12:28:24PM +0200, Avi Kivity wrote:
> >+static void add_msr_offset(u32 offset)
> >+{
> >+	u32 old;
> >+	int i;
> >+
> >+again:
> >+	for (i = 0; i<  MSRPM_OFFSETS; ++i) {
> >+		old = msrpm_offsets[i];
> >+
> >+		if (old == offset)
> >+			return;
> >+
> >+		if (old != MSR_INVALID)
> >+			continue;
> >+
> >+		if (cmpxchg(&msrpm_offsets[i], old, offset) != old)
> >+			goto again;
> >+
> >+		return;
> >+	}
> >+
> >+	/*
> >+	 * If this BUG triggers the msrpm_offsets table has an overflow. Just
> >+	 * increase MSRPM_OFFSETS in this case.
> >+	 */
> >+	BUG();
> >+}
> 
> Why all this atomic cleverness?  The possible offsets are all
> determined statically.  Even if you do them dynamically (makes sense
> when considering pmu passthrough), it's per-vcpu and therefore
> single threaded (just move msrpm_offsets into vcpu context).

The msr_offset table is the same for all guests. It doesn't make sense
to keep it per vcpu because it will currently look the same for all
vcpus. For standard guests this array contains 3 entrys. It is marked
with __read_mostly for the same reason.

> >@@ -1846,20 +1882,33 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
> >
> >  static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
> >  {
> >-	u32 *nested_msrpm;
> >-	struct page *page;
> >+	/*
> >+	 * This function merges the msr permission bitmaps of kvm and the
> >+	 * nested vmcb. It is omptimized in that it only merges the parts where
> >+	 * the kvm msr permission bitmap may contain zero bits
> >+	 */
> 
> A comment that describes the entire function can be moved above the
> function, freeing a whole tab stop for contents.

Ok, will move it out of the function.

	Joerg


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ