Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1009124imm; Thu, 31 May 2018 13:27:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQKWTsIZNjzL4PWK7sG3IRLpgTAfTLxjQeANx0V5PrDd04fcEPUqwm0+IcT5EFxZHwq1TC X-Received: by 2002:a63:788e:: with SMTP id t136-v6mr6749720pgc.424.1527798459425; Thu, 31 May 2018 13:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527798459; cv=none; d=google.com; s=arc-20160816; b=P0JoE3yr3KN80ImRy82m6vDrim8TeRuqUUOKt1+6rpGeTy0BN4WBv9O0aIa6hkodYZ 33Wzah2eg4v+P57bvw00388664EIYgj9YvS1wHusFDJxJOYeKjpmWWwaAQJSbFsjCJfX WRC8ya9BwubVIcW+lRFmH6KuuhHjurCaehykx9fE5MzDpzhgl0XS1WLOcrjcfMyIiqww zjOk1v1oCq79y/e5ctps6tjqLpHo0/envurpR5nIt5oDBcURGfsIULqFdS9TDOOy5Ewe em1d3m5DeUioxAbvcVsMZJXIxTJ6JHKL0xecIJlfJpmWTlC0wGjVhAm/8nl5U3JR0hFd qjug== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=SgNST7zYBFRmPU6cLLK91DKp5eu9uAjmikUvRA/LcNE=; b=brEPSCztGrp2xhGUjUQ1TYU/7Wr5SEIKxzR2DmmJgKWc7XryRtiE04cBA8KhqMJguQ HgPR22PxsU1zEsfZH0PdD4jPNjtk2iaMlY5o3CxHOPbRiMCC24qKHAMflSsGT8iVGO09 KEJ3aakXHAsdtTMRDy4kmvCkvQrQNdG4eN5mMxucya+HBG0ReaORsLu+P+z1J9kF56Pe 74EgQT6pc7BaftPHHCxR+0G8HC1A5jEXanTMWBtmnrKW5Hn44l0mzXaMkFQeT9IkVTIy OptTQ77fQ86F7UBfV7NMjw40gdepgl+ZqfrdVMkKPwaA89hwqj3yGXhb+k7sWYYib6Rl 0qxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NrMMDmmb; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4-v6si15778229plj.43.2018.05.31.13.27.25; Thu, 31 May 2018 13:27:39 -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=@kernel.org header.s=default header.b=NrMMDmmb; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754404AbeEaUZ2 (ORCPT + 99 others); Thu, 31 May 2018 16:25:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:49410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754089AbeEaUZ1 (ORCPT ); Thu, 31 May 2018 16:25:27 -0400 Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3E06D208B6 for ; Thu, 31 May 2018 20:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527798326; bh=9Ervoj+kDRCsHlMdGGXy8UBNWuZsMAbT2rUdHu3UgsQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NrMMDmmbmXB3d03xkEpq5LBVjg9KS2mhuLCeJ399G4/dFARxQQO4UlrljvIACD9YT V87C5/a797uTZo7ncltOc0s+t8NupGCTKgzNpac6zsJXBYL6hg+HCVssyT4AO9kPQZ 12vRAPAsYRIxIcys6RUuiJcnSY727gpgryYULYYY= Received: by mail-wm0-f48.google.com with SMTP id m129-v6so55971667wmb.3 for ; Thu, 31 May 2018 13:25:26 -0700 (PDT) X-Gm-Message-State: APt69E0UwB+jx9kdp803WcerTXgl14ZYYduw/BDoW+kzeSACm8vKEqdo RkyqiWYIGMS+6eeF+1XzAK1zdjFaxXUMGhAwWhwH3A== X-Received: by 2002:a1c:a906:: with SMTP id s6-v6mr775321wme.116.1527798324637; Thu, 31 May 2018 13:25:24 -0700 (PDT) MIME-Version: 1.0 References: <1527789525-8857-1-git-send-email-chang.seok.bae@intel.com> <1527789525-8857-6-git-send-email-chang.seok.bae@intel.com> In-Reply-To: <1527789525-8857-6-git-send-email-chang.seok.bae@intel.com> From: Andy Lutomirski Date: Thu, 31 May 2018 13:25:12 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2 05/15] x86/vdso: Move out the CPU number store To: "Bae, Chang Seok" Cc: Andrew Lutomirski , "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 Thu, May 31, 2018 at 10:58 AM Chang S. Bae wrote: > > The CPU (and node) number will be written, as early enough, > to the segment limit of per CPU data and TSC_AUX MSR entry. > The information has been retrieved by vgetcpu in user space > and will be also loaded from the paranoid entry, when > FSGSBASE enabled. So, it is moved out from vDSO to the CPU > initialization path where IST setup is serialized. > > Now, redundant setting of the segment in entry/vdso/vma.c > was removed; a substantial code removal. It removes a > hotplug notifier, makes a facility useful to both the kernel > and userspace unconditionally available much sooner, and > unification with i386. (Thanks to HPA for suggesting the > cleanup) > > Signed-off-by: Chang S. Bae > Cc: H. Peter Anvin > Cc: Dave Hansen > Cc: Andy Lutomirski > Cc: Andi Kleen > Cc: Thomas Gleixner > Cc: Ingo Molnar > +/* Bit size and mask of CPU number stored in the per CPU data */ > +#define PERCPU_CPU_SIZE 12 > +#define PERCPU_CPU_MASK 0xfff This name is confusing. Maybe LSL_TSCP_CPU_MASK? Can you also add a helpers like: static inline unsigned long make_lsl_tscp(unsigned int cpu, unsigned int node) { ... } static inline unsigned int lsl_tscp_to_cpu(unsigned long x) { ... } static inline unsigned int lsl_tscp_to_node(unsigned long x) { ... } and use them everywhere? This will make it lot easier to understand the code. > +#ifdef CONFIG_X86_32 > + GDT_ENTRY_PERCPU, > +#else /* 64 bit */ > + GDT_ENTRY_PER_CPU, > #endif Please just rename one of these to match the other one.