From: Mario Smarduch <cms063@email.mot.com>
To: linux-ia64@vger.kernel.org
Subject: Re: mmap() of /dev/kmem issue
Date: Tue, 04 May 2004 22:27:41 +0000 [thread overview]
Message-ID: <409818DC.342BE8A9@email.mot.com> (raw)
In-Reply-To: <4097C51D.71EA0BEA@email.mot.com>
It appears that from mmap_mem() noncached_address()
succeeds on PageReserved for ranges in: KERNEL_START-
KERNEL_END, I tried a temporary workaround by making
an exception to addresses in that range and things work (that
is for this program only) but what sort of problems would such a
change introduce?
if(PageReserved(page) && !((va >= KERNEL_START) && (va < KERNEL_END)) )
return (1);
I would think allot of people would like to mmap() /dev/kmem
to take a quick look at kernel values, atleast that's what I've
seen on other Unix variants.
- mario.
Grant Grundler wrote:
> On Tue, May 04, 2004 at 01:12:21PM -0500, Mario Smarduch wrote:
> > jiffies=0x`grep "D jiffies" /boot/System.map | awk '{ print $1 }'`
> > ./tstmmapkmem $jiffies
>
> Maybe the process is being prempted?
> Ie maybe the problem is the contents are "stale" by the
> time they get displayed on the console/terminal.
> jiffies gets updated 1000/second so on occasion I would
> expect this to happen.
> Maybe pick something that doesn't get updated so frequently?
>
> grant
>
> > #define DEVICE "/dev/kmem"
> > #define PAGE_MASK (0x4000 - 1) /* page is 16k */
> >
> > #define wmb() __asm__ __volatile__ ("": : :"memory")
> >
> > extern int errno;
> > main(int argc, char *argv[])
> > {
> > int fd;
> > ulong mapaddr;
> > volatile long *jifptr, jiffies;
> >
> > jiffies = strtoul(argv[1], 0, 16);
> > printf("jiffies = 0x%lx+AFw-n", jiffies);
> > printf("pid = %d+AFw-n", getpid());
> >
> > if((fd = open(DEVICE, O_RDWR)) < 0)
> > printf("open failed - errno = %d+AFw-n", errno), exit(errno);
> >
> > jiffies -= IDENBASE;
> > mapaddr=(ulong) mmap((void *)0x2000000080000000, 0x8000000,
> > PROT_WRITE|PROT_R
> > EAD|PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, jiffies & +AH4-PAGE_MASK);
> > if(mapaddr = -1UL) {
> > printf("mmap failed errno = %d+AFw-n", errno);
> > exit(-1);
> > }
> > printf("mapaddr = 0x%lx+AFw-n", mapaddr);
> > jiffies = mapaddr (jiffies & PAGE_MASK);
> > jifptr = (long *) jiffies;
> > printf("jifptr = 0x%lx+AFw-n", jifptr);
> > pragain:
> > printf("jiffies: %ld+AFw-n", *jifptr);
> >
> > printf("Type return to read again (and flush cashe in meantime):+AFw-n");
> >
> > getchar();
> > goto pragain;
> > }
> >
> > - Mario.
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2004-05-04 22:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-04 16:30 mmap() of /dev/kmem issue Mario Smarduch
2004-05-04 17:05 ` Bjorn Helgaas
2004-05-04 17:19 ` Grant Grundler
2004-05-04 18:12 ` Mario Smarduch
2004-05-04 20:29 ` Grant Grundler
2004-05-04 22:15 ` Mario Smarduch
2004-05-04 22:27 ` Mario Smarduch [this message]
2004-05-04 23:59 ` Grant Grundler
2004-05-05 14:57 ` Mario Smarduch
2004-05-05 15:08 ` Luck, Tony
2004-05-05 15:36 ` Grant Grundler
2004-05-05 15:44 ` Matthew Wilcox
2004-05-05 15:49 ` Mario Smarduch
2004-05-05 15:53 ` Mario Smarduch
2004-05-05 16:07 ` Matthew Wilcox
2004-05-05 16:18 ` Chris Wedgwood
2004-05-05 16:32 ` Mario Smarduch
2004-05-05 16:42 ` Mario Smarduch
2004-05-05 16:44 ` Luck, Tony
2004-05-05 16:57 ` Mario Smarduch
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=409818DC.342BE8A9@email.mot.com \
--to=cms063@email.mot.com \
--cc=linux-ia64@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