Re: [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. Th

Re: [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 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; >>

Re: [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 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 of that f

Re: [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: [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 mul

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

2015-07-23 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 mul

Re: [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 t

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