From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371AbbEATMU (ORCPT ); Fri, 1 May 2015 15:12:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57166 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbbEATMT (ORCPT ); Fri, 1 May 2015 15:12:19 -0400 Message-ID: <5543CFE5.1030509@redhat.com> Date: Fri, 01 May 2015 15:11:33 -0400 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Ingo Molnar CC: Andy Lutomirski , "linux-kernel@vger.kernel.org" , X86 ML , williams@redhat.com, Andrew Lutomirski , fweisbec@redhat.com, Peter Zijlstra , Heiko Carstens , Thomas Gleixner , Ingo Molnar , Paolo Bonzini , "Paul E. McKenney" , Linus Torvalds Subject: Re: [PATCH 3/3] context_tracking,x86: remove extraneous irq disable & enable from context tracking on syscall entry References: <1430429035-25563-1-git-send-email-riel@redhat.com> <1430429035-25563-4-git-send-email-riel@redhat.com> <20150501064044.GA18957@gmail.com> <554399D1.6010405@redhat.com> <20150501155912.GA451@gmail.com> <20150501162109.GA1091@gmail.com> <5543A94B.3020108@redhat.com> <20150501163431.GB1327@gmail.com> <5543C05E.9040209@redhat.com> <20150501184025.GA2114@gmail.com> In-Reply-To: <20150501184025.GA2114@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/01/2015 02:40 PM, Ingo Molnar wrote: > Or we could do that in the syscall path with a single store of a > constant flag to a location in the task struct. We have a number of > natural flags that get written on syscall entry, such as: > > pushq_cfi $__USER_DS /* pt_regs->ss */ > > That goes to a constant location on the kernel stack. On return from > system calls we could write 0 to that location. > > So the remote CPU would have to do a read of this location. There are > two cases: > > - If it's 0, then it has observed quiescent state on that CPU. (It > does not have to be atomics anymore, as we'd only observe the value > and MESI coherency takes care of it.) That should do the trick. > - If it's not 0 then the remote CPU is not executing user-space code > and we can install (remotely) a TIF_NOHZ flag in it and expect it > to process it either on return to user-space or on a context > switch. I may have to think about this a little more, but it seems like it should work. Can we use a separate byte in the flags word for flags that can get set remotely, so we can do stores and clearing of local-only flags without atomic instructions? > This way, unless I'm missing something, reduces the overhead to a > single store to a hot cacheline on return-to-userspace - which > instruction if we place it well might as well be close to zero cost. > No syscall entry cost. Slow-return cost only in the (rare) case of > someone using synchronize_rcu(). I think that should take care of the RCU aspect of nohz_full. -- All rights reversed