All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	"jeyu@kernel.org" <jeyu@kernel.org>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"jannh@google.com" <jannh@google.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"arjan@linux.intel.com" <arjan@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"kristen@linux.intel.com" <kristen@linux.intel.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	"Hansen, Dave" <dave.hansen@intel.com>
Subject: Re: [PATCH v8 4/4] Kselftest for module text allocation benchmarking
Date: Wed, 7 Nov 2018 20:03:54 +0000	[thread overview]
Message-ID: <97833c125c44ec2a8d7f96f667425d600a4fb7e3.camel@intel.com> (raw)
In-Reply-To: <20181106130557.11bfeddafe103bb609352aba@linux-foundation.org>

On Tue, 2018-11-06 at 13:05 -0800, Andrew Morton wrote:
> On Fri,  2 Nov 2018 12:25:20 -0700 Rick Edgecombe <rick.p.edgecombe@intel.com>
> wrote:
> 
> > This adds a test module in lib/, and a script in kselftest that does
> > benchmarking on the allocation of memory in the module space. Performance
> > here
> > would have some small impact on kernel module insertions, BPF JIT insertions
> > and kprobes. In the case of KASLR features for the module space, this module
> > can be used to measure the allocation performance of different
> > configurations.
> > This module needs to be compiled into the kernel because module_alloc is not
> > exported.
> 
> Well, we could export module_alloc().  Would that be helpful at all?
For me at least, it wasn't an issue to compile it into the kernel, since its
just for development testing. Since its controlled through debugfs, it doesn't
do anything until you write to it.

> > With some modification to the code, as explained in the comments, it can be
> > enabled to measure TLB flushes as well.
> > 
> > There are two tests in the module. One allocates until failure in order to
> > test module capacity and the other times allocating space in the module
> > area.
> > They both use module sizes that roughly approximate the distribution of in-
> > tree
> > X86_64 modules.
> > 
> > You can control the number of modules used in the tests like this:
> > echo m1000>/dev/mod_alloc_test
> > 
> > Run the test for module capacity like:
> > echo t1>/dev/mod_alloc_test
> > 
> > The other test will measure the allocation time, and for CONFG_X86_64 and
> > CONFIG_RANDOMIZE_BASE, also give data on how often the “backup area" is
> > used.
> > 
> > Run the test for allocation time and backup area usage like:
> > echo t2>/dev/mod_alloc_test
> > The output will be something like this:
> > num		all(ns)		last(ns)
> > 1000		1083		1099
> > Last module in backup count = 0
> > Total modules in backup     = 0
> > > 1 module in backup count   = 0
> 
> Are the above usage instructions captured in the kernel code somewhere?
> I can't see it, and expecting people to trawl git changelogs isn't
> very friendly.
> 
Thanks. I'll add the instructions to the file. For the performance test, a
script is included that does everything needed.

  reply	other threads:[~2018-11-07 20:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 19:25 [PATCH v8 0/4] KASLR feature to randomize each loadable module Rick Edgecombe
2018-11-02 19:25 ` [PATCH v8 1/4] vmalloc: Add __vmalloc_node_try_addr function Rick Edgecombe
2018-11-06 21:05   ` Andrew Morton
2018-11-07 20:03     ` Edgecombe, Rick P
2018-11-07 20:03       ` Edgecombe, Rick P
2018-11-02 19:25 ` [PATCH v8 2/4] x86/modules: Increase randomization for modules Rick Edgecombe
2018-11-06 21:05   ` Andrew Morton
2018-11-07 20:03     ` Edgecombe, Rick P
2018-11-07 20:03       ` Edgecombe, Rick P
2018-11-02 19:25 ` [PATCH v8 3/4] vmalloc: Add debugfs modfraginfo Rick Edgecombe
2018-11-02 19:25 ` [PATCH v8 4/4] Kselftest for module text allocation benchmarking Rick Edgecombe
2018-11-02 19:25   ` Rick Edgecombe
2018-11-06 21:05   ` Andrew Morton
2018-11-06 21:05     ` Andrew Morton
2018-11-07 20:03     ` Edgecombe, Rick P [this message]
2018-11-07 20:03       ` Edgecombe, Rick P
2018-11-06 21:04 ` [PATCH v8 0/4] KASLR feature to randomize each loadable module Andrew Morton
2018-11-07 20:03   ` Edgecombe, Rick P
2018-11-07 20:03     ` Edgecombe, Rick P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97833c125c44ec2a8d7f96f667425d600a4fb7e3.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=jannh@google.com \
    --cc=jeyu@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=kristen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.