Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbbDZXhB (ORCPT ); Sun, 26 Apr 2015 19:37:01 -0400 Received: from mail-la0-f48.google.com ([209.85.215.48]:35569 "EHLO mail-la0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751199AbbDZXg7 (ORCPT ); Sun, 26 Apr 2015 19:36:59 -0400 MIME-Version: 1.0 In-Reply-To: References: <5d120f358612d73fc909f5bfa47e7bd082db0af0.1429841474.git.luto@kernel.org> From: Andy Lutomirski Date: Sun, 26 Apr 2015 16:36:37 -0700 Message-ID: Subject: Re: [PATCH] x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue To: Denys Vlasenko Cc: Andy Lutomirski , X86 ML , "H. Peter Anvin" , Borislav Petkov , Linus Torvalds , Brian Gerst , Denys Vlasenko , Ingo Molnar , Steven Rostedt , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , Linux Kernel Mailing List 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: 1450 Lines: 36 On Fri, Apr 24, 2015 at 7:17 PM, Denys Vlasenko wrote: > On Fri, Apr 24, 2015 at 10:50 PM, Andy Lutomirski wrote: >> On Fri, Apr 24, 2015 at 1:46 PM, Denys Vlasenko >>>> This might be way more trouble than it's worth. >>> >>> Exactly my feeling. What are you trying to save? About four CPU >>> cycles of checking %ss != __KERNEL_DS on each switch_to? >>> That's not worth bothering about. Your last patch seems to be perfect. >> >> We'll have to do the write to ss almost every time an AMD CPU sleeps >> in a syscall. > > Why do you think so? > Scheduling from a syscall which decided to block won't require > writing to %ss, since in this case %ss isn't NULL. > > Writing to %ss will happen every time we schedule from an interrupt. > With timer interrupt every 1 ms it means scheduling at most ~1000 > times per second, if _every_ such interrupt causes task switch. > This is still not often enough to worry. OK, you've convinced me. I still think it can happen much more than ~1k times per second due to hrtimers (see my test case) or things like page faults, but those are all slow paths. v2 coming. -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/