Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932423AbcCUTYR (ORCPT ); Mon, 21 Mar 2016 15:24:17 -0400 Received: from mail-oi0-f44.google.com ([209.85.218.44]:34048 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932380AbcCUTYP (ORCPT ); Mon, 21 Mar 2016 15:24:15 -0400 MIME-Version: 1.0 In-Reply-To: <20160321190322.GZ5083@two.firstfloor.org> References: <1458576969-13309-1-git-send-email-andi@firstfloor.org> <20160321190322.GZ5083@two.firstfloor.org> From: Andy Lutomirski Date: Mon, 21 Mar 2016 12:23:54 -0700 Message-ID: Subject: Re: Updated version of RD/WR FS/GS BASE patchkit To: Andi Kleen Cc: X86 ML , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1746 Lines: 42 On Mon, Mar 21, 2016 at 12:03 PM, Andi Kleen wrote: > On Mon, Mar 21, 2016 at 11:39:07AM -0700, Andy Lutomirski wrote: >> 4. Does the sigcontext format need to change? > > I don't think it needs to be. fs/gs are global state and the > signal handlers are not likely to change it. > > Also there is no default that could be restored. > >> >> For maximum safely, comprehensibility, and sanity, there's an argument >> to be made that 1a and 2a should leave the state exactly as it started >> and that 1b and 2b should leave it alone unless percpu bases are in >> use. For maximum simplicity of implementation, there's an argument >> that, if the fs or gs selector is nonzero and the base doesn't match >> the in-memory descriptor, then the kernel can do whatever it wants. >> >> I propose the following semantics: > > So you want to change the existing semantics. We had this discussion > before. I think it is out of scope of my patch, which just extends the > existing semantics to support the instructions. > > (what happened in the system call before is now possible in ring 3) > > If you want to invent some new overengineered semantics you can do it in some > followon patch. > > Personally i think it is pointless. The existing semantics are fine. I strongly disagree. You're adding an hwcap bit because you expect user code to use this thing, which means you're adding an ABI, which means that the semantics should be given due consideration. If the goal were just to speed up context switches, then just maybe it would make sense to enable it in such a way that user code *doesn't* use it. But Intel wasn't nice enough to let us switch the bit for CPL0 only, and you added an hwcap bit, so here we are... --Andy