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] [day] [month] [year] [list]
Message-ID: <54B02232.1030609@sr71.net>
Date:	Fri, 09 Jan 2015 10:47:14 -0800
From:	Dave Hansen <dave@...1.net>
To:	Ingo Molnar <mingo@...nel.org>
CC:	linux-kernel@...r.kernel.org, tglx@...utronix.de, x86@...nel.org,
	dave.hansen@...ux.intel.com,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/2] x86 mpx: fix potential performance issue on unmaps

On 12/23/2014 01:14 AM, Ingo Molnar wrote:
>> >  {
>> > -	mpx_notify_unmap(mm, vma, start, end);
>> > +	/*
>> > +	 * mpx_notify_unmap() goes and reads a rarely-hot
>> > +	 * cacheline in the mm_struct.  That can be expensive
>> > +	 * enough to be seen in profiles.
>> > +	 *
>> > +	 * The mpx_notify_unmap() call and its contents have been
>> > +	 * observed to affect munmap() performance on hardware
>> > +	 * where MPX is not present.
>> > +	 *
>> > +	 * The unlikely() optimizes for the fast case: no MPX
>> > +	 * in the CPU, or no MPX use in the process.  Even if
>> > +	 * we get this wrong (in the unlikely event that MPX
>> > +	 * is widely enabled on some system) the overhead of
>> > +	 * MPX itself (reading bounds tables) is expected to
>> > +	 * overwhelm the overhead of getting this unlikely()
>> > +	 * consistently wrong.
>> > +	 */
>> > +	if (unlikely(cpu_feature_enabled(X86_FEATURE_MPX)))
>> > +		mpx_notify_unmap(mm, vma, start, end);
>> >  }
> Hm, so this patch still does not help people who have an MPX 
> capable CPU but don't have (or don't have many) MPX using apps. 
> What about them?

Sorry for the delayed resposne.

The performance regression, as far as I could tell, was the result of a
consistent branch misprediction near the read of mm->bd_addr.  I believe
the CPU was able to better predict cpu_feature_enabled() than the
contents of mm->bd_addr.

In running this on a CPU which actually contains MPX, I wasn't able to
see the same regression.  The same branch was getting predicted correctly.

I also have a patch to add a global, boot-time MPX disable.  It will
clear out the X86_FEATURE_MPX at __setup time.  While not optimal, this
would at least let someone who did not have any MPX apps avoid any
potential issues.  I was planning on submitting that patch for 3.20.

--
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