From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755423AbbJ1OpF (ORCPT ); Wed, 28 Oct 2015 10:45:05 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:44354 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751008AbbJ1OpB (ORCPT ); Wed, 28 Oct 2015 10:45:01 -0400 Date: Wed, 28 Oct 2015 07:44:01 -0700 From: Dave Watson To: Paul Turner CC: Peter Zijlstra , Andrew Hunter , Andy Lutomirski , Andi Kleen , Mathieu Desnoyers , "Paul E. McKenney" , , , Josh Triplett , Ingo Molnar , Chris Lameter , Linus Torvalds Subject: Re: [RFC PATCH 0/3] restartable sequences v2: fast user-space percpu critical sections Message-ID: <20151028144401.GB2994761@devbig217.prn1.facebook.com> References: <20151027235635.16059.11630.stgit@pjt-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20151027235635.16059.11630.stgit@pjt-glaptop.roam.corp.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-28_11:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/27/15 04:56 PM, Paul Turner wrote: > This series is a new approach which introduces an alternate ABI that does not > depend on open-coded assembly nor a central 'repository' of rseq sequences. > Sequences may now be inlined and the preparatory[*] work for the sequence can > be written in a higher level language. Very nice, it's definitely much easier to use. > Exactly, for x86_64 this looks like: > movq , rcx [1] > movq $1f, [2] > cmpq , [3] (start is in rcx) > jnz (4) > movq , () (5) > 1: movq $0, > > There has been some related discussion, which I am supportive of, in which > we use fs/gs instead of TLS. This maps naturally to the above and removes > the current requirement for per-thread initialization (this is a good thing!). > > On debugger interactions: > > There are some nice properties about this new style of API which allow it to > actually support safe interactions with a debugger: > a) The event counter is a per-cpu value. This means that we can not advance > it if no threads from the same process execute on that cpu. This > naturally allows basic single step support with thread-isolation. I think this means multiple processes would no longer be able to use per-cpu variables in shared memory, since they would no longer restart with respect to each other? > b) Single-step can be augmented to evalute the ABI without incrementing the > event count. > c) A debugger can also be augmented to evaluate this ABI and push restarts > on the kernel's behalf. > > This is also compatible with David's approach of not single stepping between > 2-4 above. However, I think these are ultimately a little stronger since true > single-stepping and breakpoint support would be available. Which would be > nice to allow actual debugging of sequences.