Received: by 10.192.165.156 with SMTP id m28csp81524imm; Wed, 18 Apr 2018 17:46:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49qWoHzfJdkjMaFXfpF05q76nwscJhAb4THkQLog49yp/8wmUIlcUIfJoddYwLtg1Gtb29G X-Received: by 10.99.171.72 with SMTP id k8mr3438103pgp.355.1524098802166; Wed, 18 Apr 2018 17:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524098802; cv=none; d=google.com; s=arc-20160816; b=bkdbBZUlziAfzPily7nQ6PvltpqXZkQwCNKangufuoXtXPAQuG6O4xCRInrHaKeqAB b6Z/bRI+Bvf+lUaodwRTsMNhAfBKxvNpmpD97wnoYk4ATi6LUoRwtRVlSA9ZxP2ZE9/2 a2U37//nwy1UzeXyaooq4D04pkBKcA+AONq6AjVuL6MYrxedew3uDNeOsz6B3qBQJ7St enyXflXdXjtB+8oP8ayRQ8AConVFZMf3eijvTZEbsOfRMBRg196yMUyHatgCPQO9/+tt ZssPD6Z52pXtVxl8DjcZrNyhNzo9E+ISOZ9JKYQfJi3iabu0GCiO9WPIrS5rd6zbvyvl sExA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dmarc-filter:arc-authentication-results; bh=texvfvKATPm710wwn/vhCLxnxTYX0MyRuqeSvkIrlm0=; b=lnprdPwJE0e9Ig1qLxs/dICTYQ9vyW//lRrEKBQ/Ct4UH/UNLxQs2oKlQ8wIDoeb+D nYpuJRfvKV8+aYsfcc9C+4DM5Hmc0TTanss02MQDWpXgrzWTkHb1d42k3hq/CHqUrKSS V95TXrWuyyWsloeeo5iYvGRPcI3Wi65yFQlxYlv0SoqVN+4oWxJlrPv5mRrBZ3b8Anqr riUvb2kh1msiXNHXDpBDYh+uk+1qKDHzsrI+t8d2hqjZ0ggldG/nnhiJL8/M8kAYOWZY dv/gYRYFuD+9CggK3Pjy/y+uZO2Dvjj1asANEQG9pFZhKTmFLbicJFDRkYG/bhy0S0DM mzCg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r63-v6si2165991plb.366.2018.04.18.17.46.27; Wed, 18 Apr 2018 17:46:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753153AbeDSApW convert rfc822-to-8bit (ORCPT + 99 others); Wed, 18 Apr 2018 20:45:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:55820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499AbeDSApT (ORCPT ); Wed, 18 Apr 2018 20:45:19 -0400 Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) (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 717952183D for ; Thu, 19 Apr 2018 00:45:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 717952183D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-wr0-f182.google.com with SMTP id f14-v6so9361602wre.4 for ; Wed, 18 Apr 2018 17:45:18 -0700 (PDT) X-Gm-Message-State: ALQs6tCPfycP10RXHeJ9c54FytiPpkvrJWpFX/oLUMl5TenFlGKfidfq C6oAFXAfdiCttpPQupi0CjVyXG403ME8J3G7jRsQ5g== X-Received: by 2002:adf:a592:: with SMTP id g18-v6mr3073288wrc.171.1524098716816; Wed, 18 Apr 2018 17:45:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.247.15 with HTTP; Wed, 18 Apr 2018 17:44:56 -0700 (PDT) In-Reply-To: <20180419003833.GO6694@tassilo.jf.intel.com> References: <1523892323-14741-1-git-send-email-joro@8bytes.org> <1523892323-14741-4-git-send-email-joro@8bytes.org> <87k1t4t7tw.fsf@linux.intel.com> <20180419003833.GO6694@tassilo.jf.intel.com> From: Andy Lutomirski Date: Wed, 18 Apr 2018 17:44:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 03/35] x86/entry/32: Load task stack from x86_tss.sp1 in SYSENTER handler To: Andi Kleen Cc: Linus Torvalds , Joerg Roedel , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , "the arch/x86 maintainers" , Linux Kernel Mailing List , linux-mm , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waim@linux.intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 18, 2018 at 5:38 PM, Andi Kleen wrote: > On Wed, Apr 18, 2018 at 05:02:02PM -0700, Linus Torvalds wrote: >> On Wed, Apr 18, 2018 at 4:26 PM, Andi Kleen wrote: >> > >> > Seems like a hack. Why can't that be stored in a per cpu variable? >> >> It *is* a percpu variable - the whole x86_tss structure is percpu. >> >> I guess it could be a different (separate) percpu variable, but might >> as well use the space we already have allocated. > > Would be better/cleaner to use a separate variable instead of reusing > x86 structures like this. Who knows what subtle side effects that > may have eventually. This variable is extremely hot, and it’s used under the same circumstances as sp0, so sharing a cache line makes sense. And x86_64 works this way. > > It will be also easier to understand in the code. I suppose it could go right before the TSS, but then we have potential alignment issues. We could also muck with unions to give the field an alternative, clearer name, I suppose. But this patch should go in regardless and any cleanups should be done on x86_32 and x86_64 simultaneously, I think.