Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 1997 19:17:48 +1000
From:      Stephen McKay <syssgm@dtir.qld.gov.au>
To:        freebsd-hackers@freebsd.org
Cc:        syssgm@dtir.qld.gov.au
Subject:   Re: special malloc needs... 
Message-ID:  <199708260917.TAA12957@ogre.dtir.qld.gov.au>
In-Reply-To: <199708260421.VAA21878@dragon.awen.com> from "Mike Burgett" at "Tue, 26 Aug 1997 04:21:03 %2B0000"
References:  <199708260421.VAA21878@dragon.awen.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, 26th August 1997, "Mike Burgett" wrote:

>On Tue, 26 Aug 1997 13:22:50 +0930, Mike Smith wrote:
>
>>It's almost guaranteed that either there is a hidden agenda (and I hate 
>>it when people don't explain their stupid questions), or the individual 
>>in question doesn't understand what they're asking.
>>
>>So Mike, what is it?

I thought cache optimisation was a damn good guess.  Sigh.

>Well, it doesn't really matter if it can't be done, does it?

This is where you realise that it's pointless being secretive or selective
here.  You can't do what you asked, but you can do what you want to do.

>There's some speculation about the K6 problems that have been seen, being a L1
>cache bug that can occur when addressing memory exactly 32M apart.  Just 
>wanted to try a diagnostic, to see if it can be provoked, without hacking into
>the kernel.

You should be able to mmap() all of physical memory into a process running
as root.  Then you can play games with addresses 32MB apart.  As far as I
can tell, once pages are mapped in, they won't be unmapped, unlike using
read() on /dev/mem.  So, once you get going, the virtual memory translations
should be stable.

Oh, and reads should be safe, but writes would be very entertaining. :-)

I got started on some demo code, but have to go RIGHT NOW, sorry.  Try some
variant of this:

#include <stdio.h>
#include <paths.h>
#include <sys/types.h>
#include <sys/mman.h>

...

    caddr_t all_ram;

    if ((fd = open(_PATH_MEM, 0)) == -1)
        perror(_PATH_MEM), exit(1);

    if ((all_ram = mmap(NULL, 64*1024*1024, PROT_READ, 0, fd, 0)) == MAP_FAILED)
        perror("mmap"), exit(1);


>Sorry 'bout the stupid question.

So, you'll be more direct in future?

Good luck!  I want to know if a K6 is for me!

Stephen.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708260917.TAA12957>