Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: ralf@uni-koblenz.de
Cc: linux@cthulhu.engr.sgi.com
Subject: Re: VCEI/VCED handling
Date: Tue, 29 Sep 1998 23:24:55 +0200	[thread overview]
Message-ID: <19980929232455.30571@alpha.franken.de> (raw)
In-Reply-To: <19980929015003.E2215@uni-koblenz.de>; from ralf@uni-koblenz.de on Tue, Sep 29, 1998 at 01:50:03AM +0200

On Tue, Sep 29, 1998 at 01:50:03AM +0200, ralf@uni-koblenz.de wrote:
> We've got code of which we're shure that it is correct.  Nevertheless
> Linux ist still fragile on SC machines.  I've been tracking this in
> private emails with Ulf but so far only with limited success.  Aside of
> the missing VCED / VCEI handlers there must be something else that is
> broken.

As I understand the problem now, I wrote the little test program below.
If I'll try it on a R4600PC Indy or a R4000PC Olivetti with Linux, I don't
get what I would expect. On IRIX, Linux/Alpha (I have to change the offset
between the two mapping to 0x2000, because of the bigger page size on Alphas)
and Linux/x86 the program works. IMHO this is a showstopper as we don't handle 
cache aliases right.  

How does IRIX solve this problem ? Does it disable caching for shared 
writeable pages ?

Thomas.

#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
#include <stdio.h>
#include <unistd.h>

unsigned char buf[1024];

int main (int argc, char *argv[])
{
	int fd;
	unsigned char *mem1,*mem2;

	if ((fd = open ("mmap_file",O_RDWR|O_CREAT,0644)) < 0) {
		perror ("open");
		exit (1);
	}
	write (fd, buf, sizeof(buf));

	if ((mem1 = mmap (NULL, 1024, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (unsigned char *)-1) {
		perror ("mmap mem1");
		exit (2);
	}
	if ((mem2 = mmap (mem1+0x1000, 1024, PROT_READ|PROT_WRITE,MAP_SHARED|MAP_FIXED, fd, 0)) == (unsigned char *)-1) {
		perror ("mmap mem2");
		exit (3);
	}
	printf ("mem1 %p, mem2 %p\n",mem1,mem2);

	*mem1 = 0x55;
	printf ("*mem1 = %x, *mem2 = %x\n",*mem1,*mem2);

	*mem1 = 0xaa;
	printf ("*mem1 = %x, *mem2 = %x\n",*mem1,*mem2);

	*mem2 = 0x33;
	printf ("*mem2 = %x, *mem1 = %x\n",*mem2,*mem1);

	*mem2 = 0xcc;
	printf ("*mem2 = %x, *mem1 = %x\n",*mem2,*mem1);

	return 0;
}

-- 
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
                   [Linus Torvalds in <4rikft$7g5@linux.cs.Helsinki.FI>]

  reply	other threads:[~1998-09-29 21:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-28 23:14 VCEI/VCED handling Thomas Bogendoerfer
1998-09-28 23:50 ` ralf
1998-09-29 21:24   ` Thomas Bogendoerfer [this message]
1998-09-29 22:34     ` William J. Earl
1998-09-29 23:58     ` ralf
1998-09-30  1:21       ` William J. Earl
1998-10-03 16:00         ` ralf

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=19980929232455.30571@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=linux@cthulhu.engr.sgi.com \
    --cc=ralf@uni-koblenz.de \
    /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