Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1227764imm; Wed, 6 Jun 2018 12:29:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKVDO+FJo37y00SfJwzo0MzLqKNG2AmrzD151LB689vBqAwqgI/rW9iSzVPKjKffF31YvHg X-Received: by 2002:a65:6290:: with SMTP id f16-v6mr3676999pgv.155.1528313350372; Wed, 06 Jun 2018 12:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528313350; cv=none; d=google.com; s=arc-20160816; b=Z0jvtJnkcYCvkMlJCy9vqIydBsmTsYY15S6I0IdK7bpjKC27YAq12Jz48O+8g3g37i vPCo/uToYTzQXXS09ylz0voXMFG0RM/2Ham9GcjlhxNyWdzjz+EhxOH98KkuCpoBjKV3 UhmSAsiOVQOdXWL3qDYcCEr7R+y6YA0rU3QJMaz2dUHEmfKsL0TrkELcD/GcCxWU2snY K/2OKlfcdGDwQsiS6uyU08tGDwptRfbO47esq+Mi0uiaOK647c996I23tfxQPymtTdTt 8AhGPVD3qYOoABAtEumHJHBik39/W/xc7/RYtmMLgEAnuiaM4d+I0M7V4kZCl4O6HfV6 v9Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=VIYlVzS6B5J7PrEYov4XHjDskFkG6P/eNwdZyjTJeZc=; b=DLVAG/xre4XhcCNEVohTeuZeQFER4sgQhu1CRHV6zcW5xiF7tNk+fQf6ZpH43X1B2h CO6ns25He6cojccY3nQsTvXEGHHZ4+s0tIDTk+b5S/s3YQmqfbvxgwQ8n+HL9qvr6Iat BlBJ+s6Cpu9uSQVkXoeczcsIOzn0ag3ohMyBeeW9/U+l2IMDsWPrnGSH/jLHmfGQYy03 UcTIZpdA5lkNVfGm6yEDmYDMxO+OWCDGFYjvr+8bjrDaDpawNzuab4YlPeXFQCrFojhe 0UVenzqdbZUhhA3pKUmOpa4Pjg3xx6S4MoT1giao3gSEKWKqjZmENDBltM0ErJKsqWYP LDfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=i/Vc1WMp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13-v6si18812029pgf.629.2018.06.06.12.28.55; Wed, 06 Jun 2018 12:29:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=i/Vc1WMp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932556AbeFFTHS (ORCPT + 99 others); Wed, 6 Jun 2018 15:07:18 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:41218 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753043AbeFFTHQ (ORCPT ); Wed, 6 Jun 2018 15:07:16 -0400 Received: by mail-io0-f195.google.com with SMTP id t5-v6so8887757ioa.8 for ; Wed, 06 Jun 2018 12:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=VIYlVzS6B5J7PrEYov4XHjDskFkG6P/eNwdZyjTJeZc=; b=i/Vc1WMpylCPMntnPuvy5duSZN4T034NcnlTjRFvoIpqN0Iu8/IjoLCqsxouwl1mYE wwOlAK6wLx3Ri8j1I8MbWjiHFRllk0LX4Ge2jiHAY/7WsjRFzo9zqhoGrrUM0YWqPHxm 2WHzQ8GYE9qg4hariz1qwerhs223/0FBO66+WjqgVeKj72NvgdLWWDdYoz9YodKUUDDf PzxppAR+rqWUlri72wZFAgRbTmMMzOg9OKC0uzOrcdQH4Bg4aWAJcaNtmupLJE2vt4hK 3ub9t1SKyDAa/BLUlaBRq3MWB9nr3DaIVp31/gZ+nIVuZmN9i0r0ysI8XtXvw0y2WrLs Rc5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VIYlVzS6B5J7PrEYov4XHjDskFkG6P/eNwdZyjTJeZc=; b=JROgI55raejLQPTuJOSS3APOwlrC5dscMMgDQaT64kXBrwLglJ2mcDldGoCjn6dKI4 ho8n2+Q9ib97MhiuUQwPzJ44L+Pduqm8+RW42iwf3g8XHRl1u+ezuI25D1l6hHA8Twd6 08hrdLaMlJ6cUcIvTne1ZKDmdSm7PI2lGBmOrBnlciSWepL3yJ45ei/qwdgbHRnRFvhZ EVDBSLmN40/hvZ4JFRnsUgIrE2vS0MTgqi5IST4nwwBRFnFh4aBWO5bDryz0caLQgjYD TwH5gkh42ZUjy5tLfHV+I+tJb7bFojnRhO6Ktx/ZWR1b7Cl9a3ELR23i6JIVjgiaABE7 f2bQ== X-Gm-Message-State: APt69E3hRluMaQa8nUi8eMaGihv5E79rs/Jx2do33BlkGtowCOTrxQ+F JlInBeqLARbZPSpnc2OM7y0HB0gtq5VeQS5ujg== X-Received: by 2002:a6b:82a1:: with SMTP id m33-v6mr4333300ioi.56.1528312036301; Wed, 06 Jun 2018 12:07:16 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:b155:0:0:0:0:0 with HTTP; Wed, 6 Jun 2018 12:07:15 -0700 (PDT) In-Reply-To: References: <1528302199-29619-1-git-send-email-chang.seok.bae@intel.com> <1528302199-29619-8-git-send-email-chang.seok.bae@intel.com> From: Brian Gerst Date: Wed, 6 Jun 2018 15:07:15 -0400 Message-ID: Subject: Re: [PATCH v2 7/8] x86/segments/32: Introduce CPU_NUMBER segment To: Andy Lutomirski Cc: "Bae, Chang Seok" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Andi Kleen , Dave Hansen , "Metzger, Markus T" , "Ravi V. Shankar" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 6, 2018 at 1:16 PM, Andy Lutomirski wrote: > On Wed, Jun 6, 2018 at 9:23 AM Chang S. Bae wrote: >> >> The new entry will be equivalent to that of x86-64 which >> stores CPU number. The entry is placed in segment 23 in GDT >> by bumping down 23-28 by one, which are all kernel-internal >> segments and so have no impact on user space. >> >> CPU_NUMBER segment will always be at '%ss (USER_DS) + 80' >> for the default (flat, initial) user space %ss. > > No, it won't :( This is because, on Xen PV, user code very frequently > sees a different, Xen-supplied "flat" SS value. This is definitely > true right now on 64-bit, and I'm reasonably confident it's also the > case on 32-bit. > > As it stands, as far as I can tell, we don't have a "cpu number" > segment on 32-bit kernels. I see no compelling reason to add one, and > we should definitely not add one as part of the FSGSBASE series. I > think the right solution is to rename the 64-bit segment to > "CPU_NUMBER" and then have the rearrangement of the initialization > code as a followup patch. The goal is to make the patches > individually reviewable. As it stands, this patch adds some #defines > without making them work, which is extra confusing. > > Given how many times we screwed it up, I really want the patch that > moves the initialization of the 64-bit CPU number to be obviously > correct and to avoid changing the sematics of anything except the > actual CPU number fields during boot. > > So NAK to this patch, at least as part of the FSGSBASE series. > > (My apologies -- a bunch of this is because I along with everyone else > misunderstood the existing code.) The sole purpose of this segment is for the getcpu() function in the VDSO. No other userspace code can rely on its presence or location. -- Brian Gerst