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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <81ba71741c4098591f77de4275e2df4b558b19c0.camel@redhat.com>
Date:   Wed, 31 Aug 2022 20:51:04 +0300
From:   Maxim Levitsky <mlevitsk@...hat.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
        Li RongQing <lirongqing@...du.com>
Subject: Re: [PATCH 14/19] KVM: x86: Honor architectural behavior for
 aliased 8-bit APIC IDs

On Wed, 2022-08-31 at 16:41 +0000, Sean Christopherson wrote:
> On Wed, Aug 31, 2022, Maxim Levitsky wrote:
> > On Wed, 2022-08-31 at 00:35 +0000, Sean Christopherson wrote:
> > > -		if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id])
> > > -			new->phys_map[xapic_id] = apic;
> > > +		if (kvm->arch.x2apic_format) {
> > > +			/* See also kvm_apic_match_physical_addr(). */
> > > +			if ((apic_x2apic_mode(apic) || x2apic_id > 0xff) &&
> > > +			    x2apic_id <= new->max_apic_id)
> > > +				new->phys_map[x2apic_id] = apic;
> > > +
> > > +			if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id])
> > > +				new->phys_map[xapic_id] = apic;
> > > +		} else {
> > > +			/*
> > > +			 * Disable the optimized map if the physical APIC ID is
> > > +			 * already mapped, i.e. is aliased to multiple vCPUs.
> > > +			 * The optimized map requires a strict 1:1 mapping
> > > +			 * between IDs and vCPUs.
> > > +			 */
> > > +			if (apic_x2apic_mode(apic))
> > > +				physical_id = x2apic_id;
> > > +			else
> > > +				physical_id = xapic_id;
> > > +
> > > +			if (new->phys_map[physical_id]) {
> > > +				kvfree(new);
> > > +				new = NULL;
> > > +				goto out;
> > Why not to use the same  KVM_APIC_MODE_XAPIC_FLAT |  KVM_APIC_MODE_XAPIC_CLUSTER
> > hack here?
> 
> The map's "mode" only covers logical mode (the cleanup patch renames "mode" to
> "logical_mode" to make this more clear).  There is no equivalent for dealing with
> the physical IDs.  Alternatively, a flag to say "physical map is disabled" could
> be added, but KVM already has to cleanly handle a NULL map and in all likelihood
> the logical map is also going to be disabled anyways.
> 
> Not to mention that APIC performance is unlikely to be a priority for any guest
> that triggers this code :-)
> 

Thanks for the explanation, that makes sense!

Best regards,
	Maxim Levitsky

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ