Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3754338ybi; Mon, 10 Jun 2019 16:21:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLeqytJ+L+qC2wadXvZGtXoMFrjiiS6X8+PbtoT/gUe/xMRclQ7eSou1nRRwg9SzD8dSd8 X-Received: by 2002:a63:ee0a:: with SMTP id e10mr17486879pgi.28.1560208909880; Mon, 10 Jun 2019 16:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560208909; cv=none; d=google.com; s=arc-20160816; b=JWkrFfhCKSAsAs9gSqtIlIi6NqfbXUp58FNN0LTHe0RjQhnU6C36tfNIMKV5TiTbOk sbDElJ2moc/2SyjgOR0j7cZcUMSjTkr5+P0pMUHJBSFh0mamEjYvmMTycEzZD8BHOLFf 5ELF+fa5RxBYNL1tyDvV8qlNcByIlobJ/4OvbL5A3NptSbXt+KoAs8Qk91LiacOwiMVq rBqecztie+Z4uyfcGtL+yIgcYL9AX5lHu3rHEqG2W+2d4m2oT3Wef1894K7AuJkyyNgm YwlverOY/UB5sbm/UhpLot8ielvQAc4Ik1tmG1CXONCLK7B+dIAbvMPYgyE15v27EfeM ZYjw== 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; bh=ZaE9J9S5+4tokzmlUvtvROgLbYm6CbLOjAt2bzs6+ko=; b=Ylj3j42HTNMLcRzjlc5g6FW2zXUV6Z0KgGD7GyXcOhAxT8Be1oiWBkpitBtzDlcuO/ oDfUym1Dv7ITvDeEVU4AkhOlyR7Jt9mpyeqi22rkejUn/TOT9xAsVROmaDA7AtXv8p3j jHGq4EG9TvYflWC3fZh0t+TRGNWO6PaVWupjyoXh15R+DjBt7w9hh4DxzVNWPbOAxwgb +ShDci6Srh9/n0sfGnMA6cnRZjdj2nfaJBxAlIcqLV/Cqb4VFHQBRfJRoil+Bd4DPjZR trrGK69uXVEj6Dw5aoJc8KA+nNJiyRdYX4mUC1UK5h9m0+HzdC+zhGo4/J7GTUYwPn0f vzJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XQq46nLU; 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 q6si10823435pgm.101.2019.06.10.16.21.34; Mon, 10 Jun 2019 16:21:49 -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=XQq46nLU; 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 S2390568AbfFJXVa (ORCPT + 99 others); Mon, 10 Jun 2019 19:21:30 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:45538 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390500AbfFJXV3 (ORCPT ); Mon, 10 Jun 2019 19:21:29 -0400 Received: by mail-oi1-f196.google.com with SMTP id m206so7523917oib.12; Mon, 10 Jun 2019 16:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZaE9J9S5+4tokzmlUvtvROgLbYm6CbLOjAt2bzs6+ko=; b=XQq46nLUk1w0so/Oo7f4Obzwh/o1q87LWsXwXUYuy18n6wtiBRK2ftGBmxm0auLw3C 2yYiVAkdcv6+/IVh7X6QrM0UoSGQyitdM1QDCifV12RE9hSZfSNyJQrEQfP2SMg4enWZ 9LDHi3uZQaqUAoUSQ0q3cxiPm+2hhlnnol/CR7tdZmeUtkO7SxOTVDda6RZ80MibiTWD lnM9MHvgLA0qymLGPVIp3eSUnd1KmStoOEVcrMnZzpgJDMBk/K3h1H5rHaQxobmMSEsZ 7xq5E1OCNHUfIZU9DJSeMtA0aMcMep/1d7coTjVhV//p15VgmmRXrPIBHbhiOyr1iHtd A5xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZaE9J9S5+4tokzmlUvtvROgLbYm6CbLOjAt2bzs6+ko=; b=luuLNQQfplYtfLVJ44OyRDTbHQm4hNDi/FzsHr9LXKoIF9pnXXjIAqVgqxPfySUvMA 0Bf/4bgcxBFmzcKBOsI+57msF4o4SpbLQAk3zCIvY4Rbf0zaZ+wqrOJcivFFgcgFUg40 yZQwwxV2Ml/79TNGR11xnzdZ/VMyuWqV5B4NRC0FL1eGWmPlICp5bLn1U2PIW+OfWs1L f3yOa6mJc6c/aGhfpVpNX3by1wzHOPw92R1habqATxfopdsUtjGynVJRLbTMGELrm5xH w8nXC1Hu5a56FJTryL0XDmFD+rhonVJltjJzYmG9KWBPEzIGNFbc8EuEXautXYXX7wm6 i85A== X-Gm-Message-State: APjAAAWIt247kDgRRxUTz31YkXSUK5XnK/Jtk65KlFPO++agY00yH8BD 2i/LK1vRobbWYomsxQV0WAP59zHQQFEnFceNlZ0= X-Received: by 2002:aca:c508:: with SMTP id v8mr13855096oif.104.1560208888753; Mon, 10 Jun 2019 16:21:28 -0700 (PDT) MIME-Version: 1.0 References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190606200926.4029-4-yu-cheng.yu@intel.com> <20190607080832.GT3419@hirez.programming.kicks-ass.net> <20190607174336.GM3436@hirez.programming.kicks-ass.net> <34E0D316-552A-401C-ABAA-5584B5BC98C5@amacapital.net> <7e0b97bf1fbe6ff20653a8e4e147c6285cc5552d.camel@intel.com> <25281DB3-FCE4-40C2-BADB-B3B05C5F8DD3@amacapital.net> <3f19582d-78b1-5849-ffd0-53e8ca747c0d@intel.com> <5aa98999b1343f34828414b74261201886ec4591.camel@intel.com> <0665416d-9999-b394-df17-f2a5e1408130@intel.com> <5c8727dde9653402eea97bfdd030c479d1e8dd99.camel@intel.com> <328275c9b43c06809c9937c83d25126a6e3efcbd.camel@intel.com> <92e56b28-0cd4-e3f4-867b-639d9b98b86c@intel.com> <1b961c71d30e31ecb22da2c5401b1a81cb802d86.camel@intel.com> In-Reply-To: From: "H.J. Lu" Date: Mon, 10 Jun 2019 16:20:52 -0700 Message-ID: Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function To: Dave Hansen Cc: Yu-cheng Yu , Andy Lutomirski , Peter Zijlstra , "the arch/x86 maintainers" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , linux-doc@vger.kernel.org, Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin 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 Mon, Jun 10, 2019 at 3:59 PM Dave Hansen wrote: > > > We then create PR_MARK_CODE_AS_LEGACY. The kernel will set the bitmap, but it > > is going to be slow. > > Slow compared to what? We're effectively adding one (quick) system call > to a path that, today, has at *least* half a dozen syscalls and probably > a bunch of page faults. Heck, we can probably avoid the actual page > fault to populate the bitmap if we're careful. That alone would put a > syscall on equal footing with any other approach. If the bit setting > crossed a page boundary it would probably win. > > > Perhaps we still let the app fill the bitmap? > > I think I'd want to see some performance data on it first. Updating legacy bitmap in user space from kernel requires long q; get_user(q, ...); q |= mask; put_user(q, ...); instead of *p |= mask; get_user + put_user was quite slow when we tried before. -- H.J.