From: Dave Hansen Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function Date: Mon, 10 Jun 2019 16:37:09 -0700 Message-ID: <46043aaf-7fd8-2aa1-2306-24de5bff64bf@intel.com> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: "H.J. Lu" 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 List-Id: linux-api@vger.kernel.org On 6/10/19 4:20 PM, H.J. Lu wrote: >>> 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. Numbers, please. There are *lots* of ways to speed something like that up if you have actual issues with it. For instance, you can skip the get_user() for whole bytes. You can write bits with 0's for unallocated address space. You can do user_access_begin/end() to avoid bunches of STAC/CLACs... The list goes on and on. :)