Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2869608ybi; Mon, 17 Jun 2019 11:46:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEWpO4mhqZ38hL+KWHQiIzb9iAq19lB8kT6v9nDQGmKw4/e4LJeHJhbe6p4FdpQdATn+d6 X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr67145557plb.76.1560797201941; Mon, 17 Jun 2019 11:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560797201; cv=none; d=google.com; s=arc-20160816; b=H+is5thKwu3fVz9rNB5ie8gEZbPwJIPWCHIEooFyLwaMZS4dQRJHs3o0978mhh4B1+ meyOZKBBkNndFk5k9p+l5shNlFcR5Ob5I9bvemg6RvGgoEMg9s8eCpmZkXyXKv66oXkX kMXsr0Qgp5UM0bkquAg6bR9Py68x/WgEhVr9BB4KM88UlmJ63ziauKcJw1fH9QmjShsb tjp2B7Ysf8TgaQw2/bWPBWUs4JO73s0QT8NVEeh8eRjLg5wFnMNceGTaVxia6rhn77Tv ZelxsFTVRsbiEVxO23YmC7k5E0NTyb2oy6wiMtS/DuIVo5XE/unVsHufcblJGAgXAcdg g22A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GOIdRAMf3skF4wPK2T/7fFj0vhfi1GT6kR2ybYgOAu4=; b=aJVxFuaGjwLGc+GwXROFxGkCClmeB5cHvnh4PCqNLSsTRk4tGtU6RXfS7K1AhFZeKW /+eWgOVH45/yLlR3tybTZ2/uz7potOKz0QGOLspL2PvtHs6YFP+QgmDHo7Eov+qDjgZJ XJY6meUFRreTgrV9qa20W8cDLBcanXwTcug4513wswtpNsp3fLBCv6tG53yQqjYS6m3z RdbRcdssFcrzOGE7P6EUxcLXdHsdvCiayZKR+f6B+JvgI+Fre7lgnQBW8kM8kncJ6SQe Uf4SnfSwenEiQdUacgvUWRkeM0fG9K9UaNyhHK3TEaAxj279u2uFFCU7oESGEhn5YY43 Iw9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=lljcPfBp; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si10952300pfr.27.2019.06.17.11.46.25; Mon, 17 Jun 2019 11:46:41 -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=@oracle.com header.s=corp-2018-07-02 header.b=lljcPfBp; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728375AbfFQSpE (ORCPT + 99 others); Mon, 17 Jun 2019 14:45:04 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:59436 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726007AbfFQSpD (ORCPT ); Mon, 17 Jun 2019 14:45:03 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HIhvF7186461; Mon, 17 Jun 2019 18:44:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=GOIdRAMf3skF4wPK2T/7fFj0vhfi1GT6kR2ybYgOAu4=; b=lljcPfBpWWXCHaf1yRMmXyfI54fHwvCFKfK5VIao6y/jBGDnvk52ml8ocSTuVDbgc2QO aKpxdSEeWRAAE+4oDoqRrIrhX+jfnrFlj7QNLaYUL0F/6MzY/SzEzmD1f6vEiHByXW49 VI5gQ1ROqihrvrj4+AK0i3Ww+1kYqFVi58GQ0JM//3tp5uKq7RYNjAPJf5QPQ90/6ssZ kh8E6dIhQMuR1uTOnbVXsoqrYQL40V88lnlUVGONOr9O9ZVkcJjKoy+5QYdfAgjFfDej Jv53Hqeo8nSxxDhrbBtZbtWsG6GEfXzg37XQNCJA9pfhAEwU7SeLpbHIik7nMCKfnIBS xg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2t4saq83g6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 18:44:19 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HIhXeI066471; Mon, 17 Jun 2019 18:44:19 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2t59gdcub9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 18:44:19 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5HIiDdo015527; Mon, 17 Jun 2019 18:44:14 GMT Received: from char.us.oracle.com (/10.152.32.25) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 17 Jun 2019 11:44:12 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id DF1D76A0120; Mon, 17 Jun 2019 14:45:36 -0400 (EDT) Date: Mon, 17 Jun 2019 14:45:36 -0400 From: Konrad Rzeszutek Wilk To: Dave Hansen Cc: Nadav Amit , Andy Lutomirski , Alexander Graf , Thomas Gleixner , Marius Hillenbrand , kvm list , LKML , Kernel Hardening , Linux-MM , Alexander Graf , David Woodhouse , the arch/x86 maintainers , Peter Zijlstra Subject: Re: [RFC 00/10] Process-local memory allocations for hiding KVM secrets Message-ID: <20190617184536.GB11017@char.us.oracle.com> References: <58788f05-04c3-e71c-12c3-0123be55012c@amazon.com> <63b1b249-6bc7-ffd9-99db-d36dd3f1a962@intel.com> <698ca264-123d-46ae-c165-ed62ea149896@intel.com> <5AA8BF10-8987-4FCB-870C-667A5228D97B@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9291 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906170165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9291 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906170166 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 11:07:45AM -0700, Dave Hansen wrote: > On 6/17/19 9:53 AM, Nadav Amit wrote: > >>> For anyone following along at home, I'm going to go off into crazy > >>> per-cpu-pgds speculation mode now... Feel free to stop reading now. :) > >>> > >>> But, I was thinking we could get away with not doing this on _every_ > >>> context switch at least. For instance, couldn't 'struct tlb_context' > >>> have PGD pointer (or two with PTI) in addition to the TLB info? That > >>> way we only do the copying when we change the context. Or does that tie > >>> the implementation up too much with PCIDs? > >> Hmm, that seems entirely reasonable. I think the nasty bit would be > >> figuring out all the interactions with PV TLB flushing. PV TLB > >> flushes already don't play so well with PCID tracking, and this will > >> make it worse. We probably need to rewrite all that code regardless. > > How is PCID (as you implemented) related to TLB flushing of kernel (not > > user) PTEs? These kernel PTEs would be global, so they would be invalidated > > from all the address-spaces using INVLPG, I presume. No? > > The idea is that you have a per-cpu address space. Certain kernel > virtual addresses would map to different physical address based on where > you are running. Each of the physical addresses would be "owned" by a > single CPU and would, by convention, never use a PGD that mapped an > address unless that CPU that "owned" it. > > In that case, you never really invalidate those addresses. But you would need to invalidate if the process moved to another CPU, correct?