public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas George <nicolas.george@ens.fr>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix mmap kmem (was: [question] What's the difference between /dev/kmem and /dev/mem)
Date: Sat, 13 Aug 2005 15:39:25 +0200	[thread overview]
Message-ID: <20050813133925.GA29182@clipper.ens.fr> (raw)
In-Reply-To: <Pine.LNX.4.58.0508120930150.3295@g5.osdl.org>

[-- Attachment #1: Type: text/plain, Size: 2181 bytes --]

Le quintidi 25 thermidor, an CCXIII, Linus Torvalds a écrit :
> We do need to support /dev/mem for X, but even that might go away some 
> day. 

If I may interfere, I would like to point another use of /dev/mem:
long-running memory tests that do not alter the service much. I have written
a small package which does such tests. The principle is to write
pseudo-random data in a page, and later read it back and compare it to what
it should be. For such a test, /dev/mem can be used two ways:

- to access memory pages that have been disabled by mem=/memmap= command
  lines arguments;

- to look for the physical address of an userland-allocated and mlock()ed
  page (by writing a known pattern in it).

(Well, I am not even sure that the physical address of a mlock()ed page can
not change.)

With the increasing cheapness but lack of reliability of noname RAM, such
tests become very useful for home and even professional usage. I could
easyly imagine a fully automated distribution that would enable such a test
tool for a month after the first installation, for example.

It can be noted that those tests do not require the full features of
/dev/mem, and especially not the security threatening ones. It would be
sufficient to have some sort of API to:

- map a particular physical page of memory in a process' address space,
  optionnally reallocating a previous usage of that page, and failing if it
  can not be done;

- ask the physical address of a maped page.

The second can be done with /proc/kcore, but it depends on internal
structures of the kernel. I believe it could easily be done with a
/proc/$PID/maps-like file.

The first could be implemented as a flag to mmap (maybe MAP_PHYSICAL) which
would cause the addr argument to be the physical address of the requested
page.

It may seem a lot of trouble for some very specific need, but I have
remarked that bad memory bits are an increasing problem, and ECC memory and
motherboards supporting it are not easy to find for non high-grade
professional hardware. A well-integrated software workaround would be really
useful I believe.

Regads,

-- 
  Nicolas George

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 185 bytes --]

  parent reply	other threads:[~2005-08-13 13:39 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11 21:36 [question] What's the difference between /dev/kmem and /dev/mem Steven Rostedt
2005-08-12  1:15 ` [PATCH] Fix mmap_kmem (was: [question] What's the difference between /dev/kmem and /dev/mem) Steven Rostedt
2005-08-12 14:25   ` Hugh Dickins
2005-08-12 16:35   ` Linus Torvalds
2005-08-12 16:56     ` Dave Jones
2005-08-12 17:07       ` Steven Rostedt
2005-08-12 17:16         ` Arjan van de Ven
2005-08-12 17:32           ` Steven Rostedt
2005-08-12 17:01     ` Steven Rostedt
2005-08-13 13:39     ` Nicolas George [this message]
2005-08-13 16:50     ` Arjan van de Ven
2005-08-13 16:56       ` Linus Torvalds
2005-08-13 17:25         ` Arjan van de Ven
2005-08-13 17:37           ` Linus Torvalds
2005-08-13 18:18             ` Arjan van de Ven
2005-08-16 22:12               ` Greg Edwards
2005-08-16 23:33                 ` Alan Cox
2005-08-16 23:47                   ` Steven Rostedt
2005-08-15 19:33             ` Olaf Hering
2005-08-15 21:14               ` Jeff Dike
2005-08-15 21:50                 ` Olaf Hering
2005-08-15 22:41               ` Linus Torvalds
2005-08-16  1:16             ` Steven Rostedt
2005-08-16  1:22               ` Steven Rostedt
2005-08-16  1:36                 ` Linus Torvalds
2005-08-13 16:57       ` Joshua Hudson
2005-08-13 17:27         ` Arjan van de Ven
2005-08-14 14:50       ` Martin J. Bligh
2005-08-18 14:07         ` Arjan van de Ven
2005-08-18 14:18           ` Steven Rostedt
     [not found] <1123796188.17269.127.camel@localhost.localdomain.suse.lists.linux.kernel>
     [not found] ` <1123809302.17269.139.camel@localhost.localdomain.suse.lists.linux.kernel>
     [not found]   ` <Pine.LNX.4.58.0508120930150.3295@g5.osdl.org.suse.lists.linux.kernel>
2005-08-12 16:54     ` Andi Kleen
2005-08-12 17:56       ` Arjan van de Ven
2005-08-12 18:26         ` Andi Kleen
2005-08-13  9:56       ` Ingo Oeser
2005-08-13 12:40         ` Andi Kleen

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=20050813133925.GA29182@clipper.ens.fr \
    --to=nicolas.george@ens.fr \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox