Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] unreliable mmap on 720
@ 2002-08-15 21:49 Jochen Friedrich
  2002-10-23 23:01 ` [parisc-linux] unreliable mmap Jochen Friedrich
  0 siblings, 1 reply; 4+ messages in thread
From: Jochen Friedrich @ 2002-08-15 21:49 UTC (permalink / raw)
  To: HP900 PARISC mailing list

Hi,

i recognized that mmap operations seem unreliable on HP720 platform. The 
following test program (taken from cyrus imap configure) demonstrates the 
problem:

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

main()
{
  char *base;
  int fd = open("testmmap", O_RDWR|O_CREAT|O_TRUNC, 0666);

  if (fd == -1)
  {
    printf("can't open testmmap\n");
    exit(1);
  }
  if (write(fd, "test", 4) != 4)
  {
    printf("can't write testmmap\n");
    exit(1);
  }
  fsync(fd);
  base = mmap((caddr_t)0, 100, PROT_READ, MAP_SHARED
#ifdef MAP_FILE
  | MAP_FILE
#endif
#ifdef MAP_VARIABLE
  | MAP_VARIABLE
#endif
  , fd, 0L);

  if (base == (caddr_t)-1)
  {
    printf("can't mmap testmmap\n");
    exit(1);
  }
  if (strncmp(base, "test", 4) != 0)
  {
    printf("memory not test\n");
    exit(1);
  }
  if (write(fd, "test", 4) != 4) 
  {
    printf("can't append testmmap\n");
    exit(1);
  }
  fsync(fd);
  if (strncmp(base+4, "test", 4) != 0)
  {
    printf("memory not testtest: %s\n", base);
    exit(1);
  }
  exit(0);
}

# ./testmmap
memory not testtest: test
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
# ./testmmap
memory not testtest: testtest

This only seems to happen on 720 (i couldn't replicate the bug on a 715 
with the same kernel booted up). Things seem to get worse if the load on 
the box rises (if the test is done on an idle machine, testmmap works 
without problems). Weird...

This is 2.4.19-pa3.

Cheers,
--jochen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-03 11:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-15 21:49 [parisc-linux] unreliable mmap on 720 Jochen Friedrich
2002-10-23 23:01 ` [parisc-linux] unreliable mmap Jochen Friedrich
2002-10-23 23:15   ` Randolph Chung
2002-11-03 11:33     ` Jochen Friedrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox