Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-25 Thread Borislav Petkov
On Fri, Jul 24, 2015 at 09:52:01PM -0700, Andy Lutomirski wrote: I see your wide terminal and raise you a complete rewrite of that function. Sigh, why did I assume the old code was the right way to do it? That's a mostly wrong assumption, as experience proves. Hah¸ we both missed it. This

Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-24 Thread Borislav Petkov
On Wed, Jul 22, 2015 at 12:23:46PM -0700, Andy Lutomirski wrote: modify_ldt has questionable locking and does not synchronize threads. Improve it: redesign the locking and synchronize all threads' LDTs using an IPI on all modifications. This will dramatically slow down modify_ldt in

Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-24 Thread Borislav Petkov
On Wed, Jul 22, 2015 at 12:23:46PM -0700, Andy Lutomirski wrote: modify_ldt has questionable locking and does not synchronize threads. Improve it: redesign the locking and synchronize all threads' LDTs using an IPI on all modifications. This will dramatically slow down modify_ldt in

Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-24 Thread Boris Ostrovsky
On 07/22/2015 06:20 PM, Boris Ostrovsky wrote: On 07/22/2015 03:23 PM, Andy Lutomirski wrote: +error = -ENOMEM; +new_ldt = alloc_ldt_struct(newsize); +if (!new_ldt) goto out_unlock; -} -fill_ldt(ldt, ldt_info); -if (oldmode) -ldt.avl = 0; +if

Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-24 Thread Andy Lutomirski
On Fri, Jul 24, 2015 at 8:29 AM, Borislav Petkov b...@alien8.de wrote: Let it stick out: if (!cpumask_equal(mm_cpumask(current_mm), cpumask_of(smp_processor_id( smp_call_function(flush_ldt, current_mm, 1); I see your wide terminal and raise you a complete rewrite

Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-24 Thread Andy Lutomirski
On Fri, Jul 24, 2015 at 9:13 PM, Boris Ostrovsky boris.ostrov...@oracle.com wrote: On 07/22/2015 06:20 PM, Boris Ostrovsky wrote: On 07/22/2015 03:23 PM, Andy Lutomirski wrote: +error = -ENOMEM; +new_ldt = alloc_ldt_struct(newsize); +if (!new_ldt) goto out_unlock;

[Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-22 Thread Andy Lutomirski
modify_ldt has questionable locking and does not synchronize threads. Improve it: redesign the locking and synchronize all threads' LDTs using an IPI on all modifications. This will dramatically slow down modify_ldt in multithreaded programs, but there shouldn't be any multithreaded programs

Re: [Xen-devel] [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous

2015-07-22 Thread Boris Ostrovsky
On 07/22/2015 03:23 PM, Andy Lutomirski wrote: modify_ldt has questionable locking and does not synchronize threads. Improve it: redesign the locking and synchronize all threads' LDTs using an IPI on all modifications. This will dramatically slow down modify_ldt in multithreaded programs, but