Subject: mmap (?) regression between 2005-07-15 and 2005-07-19
To: None <current-users@netbsd.org>
From: Jukka Salmi <j+nbsd@2005.salmi.ch>
List: current-users
Date: 07/21/2005 23:10:23
--CUfgB8w4ZwR/yMy5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
while building graphics/ImageMagick from pkgsrc on a i386 system I noticed
a problem, but I could not yet find the culprit. Configuring ImageMagick
stopped while printing `checking for working mmap file i/o...', and CPU
usage raised:
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
27606 pkgbuild 55 0 28K 464K RUN 2:04 100.05% 99.85% conftest
The source of the `conftest' program generated by `configure' is attached.
It's line no 217 where it hangs.
Important: executing `conftest' succeeds here _unless_ it is executed on
a null-mounted filesystem:
$ mount
[...]
/dev/ccd0a on /ffs type ffs (local)
/ffs on /null type null (local)
Executing it on the ffs works fine:
$ cp conftest.c /ffs
$ cd /ffs
$ gcc conftest.c
$ ./a.out
$ echo $?
0
But executing it on the (same but) null-mounted filesystem takes forever:
$ cd /null
$ ./a.out
^C
$ echo $?
130
I also tried null-mounted ffs on raid with the same result.
Another probably even more important fact: I can't reproduce this with a
kernel built using sources as of 2005-07-15; i.e. the problem was introduced
between then and 2005-07-19. Diff(1)ed ident output between old and new
kernels (both GENERIC 3.99.7) is attached.
What could cause this regression?
TIA, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
--CUfgB8w4ZwR/yMy5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="conftest.c"
/* confdefs.h. */
#define PACKAGE_NAME "magick/magick.h"
#define PACKAGE_TARNAME "magick-magick-h"
#define PACKAGE_VERSION " "
#define PACKAGE_STRING "magick/magick.h "
#define PACKAGE_BUGREPORT "http://www.imagemagick.org"
#define _GNU_SOURCE 1
#define HAVE_FSEEKO 1
#define STDC_HEADERS 1
#define HAVE_DIRENT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define LTDL_SHLIB_EXT ".so"
#define LTDL_SHLIBPATH_VAR "LD_LIBRARY_PATH"
#define LTDL_SYSSEARCHPATH "/lib:/usr/lib"
#define LTDL_OBJDIR ".libs/"
#define HAVE_PRELOADED_SYMBOLS 1
#define HAVE_LIBDL 1
#define HAVE_DLERROR 1
#define error_t int
#define HAVE_ASSERT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_ERRNO_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDIO_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STRING_H 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_STRCMP 1
#define HAVE_CLOSEDIR 1
#define HAVE_OPENDIR 1
#define HAVE_READDIR 1
#ifdef __cplusplus
extern "C" void std::exit (int) throw (); using std::exit;
#endif
#define UseInstalledMagick 1
#define QuantumDepth 16
#define STDC_HEADERS 1
#define HAVE_DIRENT_H 1
#define HAVE_ERRNO_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LOCALE_H 1
#define HAVE_MACHINE_PARAM_H 1
#define HAVE_STDARG_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define HAVE__BOOL 1
#define HAVE_STDBOOL_H 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_LONG_DOUBLE 1
#define SIZEOF_SHORT 2
#define SIZEOF_UNSIGNED_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_UNSIGNED_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_UNSIGNED_LONG 4
#define SIZEOF_SIZE_T 4
#define SIZEOF_SSIZE_T 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_UNSIGNED_LONG_LONG 8
#define SIZEOF_LONG_DOUBLE 12
#define RETSIGTYPE void
#define HAVE_DECL_SYS_SIGLIST 1
#define HAS_C__func__ 1
#define HAVE_STDLIB_H 1
#define HAVE_UNISTD_H 1
#define HAVE_GETPAGESIZE 1
/* end confdefs.h. */
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
/* malloc might have been renamed as rpl_malloc. */
#undef malloc
/*
This test is derived from GNU Autoconf's similar macro.
The purpose of this test is to verify that files may be memory
mapped, and that memory mapping and file I/O are coherent.
The test creates a test file, memory maps the file, updates
the file using the memory map, and then reads the file using
file I/O to verify that the file contains the updates.
*/
#include <fcntl.h>
#include <sys/mman.h>
#if !STDC_HEADERS && !HAVE_STDLIB_H
char *malloc ();
#endif
/* This mess was copied from the GNU getpagesize.h. */
#if !HAVE_GETPAGESIZE
/* Assume that all systems that can run configure have sys/param.h. */
# if !HAVE_SYS_PARAM_H
# define HAVE_SYS_PARAM_H 1
# endif
# ifdef _SC_PAGESIZE
# define getpagesize() sysconf(_SC_PAGESIZE)
# else /* no _SC_PAGESIZE */
# if HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else /* no EXEC_PAGESIZE */
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif /* no CLSIZE */
# else /* no NBPG */
# ifdef NBPC
# define getpagesize() NBPC
# else /* no NBPC */
# ifdef PAGESIZE
# define getpagesize() PAGESIZE
# endif /* PAGESIZE */
# endif /* no NBPC */
# endif /* no NBPG */
# endif /* no EXEC_PAGESIZE */
# else /* no HAVE_SYS_PARAM_H */
# define getpagesize() 8192 /* punt totally */
# endif /* no HAVE_SYS_PARAM_H */
# endif /* no _SC_PAGESIZE */
#endif /* no HAVE_GETPAGESIZE */
int
main ()
{
char *data, *data2, *data3;
int i, pagesize;
int fd;
pagesize = getpagesize ();
/* First, make a file with some known garbage in it. */
data = (char *) malloc (pagesize);
if (!data)
exit (1);
for (i = 0; i < pagesize; ++i)
*(data + i) = rand ();
umask (0);
fd = creat ("conftest.mmap", 0600);
if (fd < 0)
exit (1);
if (write (fd, data, pagesize) != pagesize)
exit (1);
close (fd);
/* Mmap the file as read/write/shared and verify that we see the
same garbage. */
fd = open ("conftest.mmap", O_RDWR);
if (fd < 0)
exit (1);
data2 = mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0L);
if (data2 == 0)
exit (1);
for (i = 0; i < pagesize; ++i)
if (*(data + i) != *(data2 + i))
exit (1);
/* Finally, make sure that changes to the mapped area
percolate back to the file as seen by read(). */
for (i = 0; i < pagesize; ++i)
*(data2 + i) = *(data2 + i) + 1;
data3 = (char *) malloc (pagesize);
if (!data3)
exit (1);
if (read (fd, data3, pagesize) != pagesize)
exit (1);
for (i = 0; i < pagesize; ++i)
if (*(data2 + i) != *(data3 + i))
exit (1);
close (fd);
exit (0);
}
--CUfgB8w4ZwR/yMy5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ident.diff"
< $NetBSD: GENERIC,v 1.685 2005/07/11 15:37:04 kiyohara Exp $
> $NetBSD: GENERIC,v 1.689 2005/07/18 12:02:21 augustss Exp $
< $NetBSD: ata_raid.c,v 1.13 2005/06/20 02:11:57 briggs Exp $
> $NetBSD: ata_raid.c,v 1.14 2005/07/18 15:21:48 briggs Exp $
< $NetBSD: ehci.c,v 1.104 2005/05/30 04:21:39 christos Exp $
> $NetBSD: ehci.c,v 1.105 2005/07/18 11:08:00 augustss Exp $
< $NetBSD: exec_elf32.c,v 1.104 2005/05/29 22:24:14 christos Exp $
< $NetBSD: exec_script.c,v 1.41 2005/06/27 17:11:20 elad Exp $
> $NetBSD: exec_elf32.c,v 1.106 2005/07/17 23:53:57 junyoung Exp $
> $NetBSD: exec_script.c,v 1.43 2005/07/17 05:22:34 christos Exp $
< $NetBSD: ffs_alloc.c,v 1.84 2005/06/06 17:10:25 dbj Exp $
< $NetBSD: ffs_balloc.c,v 1.37 2004/12/15 07:11:51 mycroft Exp $
< $NetBSD: ffs_inode.c,v 1.71 2004/08/15 19:01:16 mycroft Exp $
< $NetBSD: ffs_snapshot.c,v 1.17 2005/05/29 21:25:24 christos Exp $
> $NetBSD: ffs_alloc.c,v 1.85 2005/07/15 05:01:16 thorpej Exp $
> $NetBSD: ffs_balloc.c,v 1.38 2005/07/15 05:01:16 thorpej Exp $
> $NetBSD: ffs_inode.c,v 1.72 2005/07/15 05:01:16 thorpej Exp $
> $NetBSD: ffs_snapshot.c,v 1.18 2005/07/15 05:01:16 thorpej Exp $
< $NetBSD: ffs_subr.c,v 1.33 2005/02/26 22:32:20 perry Exp $
> $NetBSD: ffs_subr.c,v 1.34 2005/07/15 05:01:16 thorpej Exp $
< $NetBSD: ffs_vfsops.c,v 1.165 2005/06/28 09:30:38 yamt Exp $
< $NetBSD: ffs_vnops.c,v 1.69 2005/02/26 22:32:20 perry Exp $
> $NetBSD: ffs_vfsops.c,v 1.166 2005/07/15 05:01:16 thorpej Exp $
> $NetBSD: ffs_vnops.c,v 1.70 2005/07/15 05:01:16 thorpej Exp $
< $NetBSD: genfs_vnops.c,v 1.98 2005/06/28 09:30:37 yamt Exp $
> $NetBSD: genfs_vnops.c,v 1.102 2005/07/17 16:07:19 yamt Exp $
< $NetBSD: if_tlp_pci.c,v 1.80 2005/06/23 23:51:41 rpaulo Exp $
> $NetBSD: if_tlp_pci.c,v 1.81 2005/07/17 00:44:13 rpaulo Exp $
< $NetBSD: init_main.c,v 1.248 2005/06/23 00:30:28 thorpej Exp $
< $NetBSD: init_sysctl.c,v 1.46 2005/06/17 23:53:21 atatat Exp $
> $NetBSD: init_main.c,v 1.250 2005/07/16 22:47:18 christos Exp $
> $NetBSD: init_sysctl.c,v 1.47 2005/07/16 22:47:18 christos Exp $
< $NetBSD: kern_exec.c,v 1.204 2005/07/11 20:15:26 cube Exp $
> $NetBSD: kern_exec.c,v 1.205 2005/07/16 22:47:18 christos Exp $
< $NetBSD: ohci.c,v 1.166 2005/05/31 19:21:08 drochner Exp $
> $NetBSD: ohci.c,v 1.167 2005/07/18 11:08:00 augustss Exp $
< $NetBSD: rf_reconstruct.c,v 1.88 2005/06/08 02:00:53 oster Exp $
> $NetBSD: rf_reconstruct.c,v 1.89 2005/07/18 15:32:01 oster Exp $
< $NetBSD: st.c,v 1.181 2005/05/29 22:00:50 christos Exp $
> $NetBSD: st.c,v 1.182 2005/07/16 05:12:26 rtr Exp $
< $NetBSD: tulip.c,v 1.138 2005/07/08 05:07:31 thorpej Exp $
> $NetBSD: tulip.c,v 1.139 2005/07/17 18:11:36 he Exp $
< $NetBSD: ufs_inode.c,v 1.49 2005/07/10 01:08:52 thorpej Exp $
> $NetBSD: ufs_inode.c,v 1.50 2005/07/17 09:13:35 yamt Exp $
< $NetBSD: uhci.c,v 1.189 2005/05/30 04:21:39 christos Exp $
> $NetBSD: uhci.c,v 1.190 2005/07/18 11:08:00 augustss Exp $
< $NetBSD: uvm_bio.c,v 1.39 2005/06/27 02:19:48 thorpej Exp $
> $NetBSD: uvm_bio.c,v 1.40 2005/07/17 09:13:35 yamt Exp $
< $NetBSD: uvm_fault.c,v 1.95 2005/06/27 02:19:48 thorpej Exp $
> $NetBSD: uvm_fault.c,v 1.96 2005/07/17 12:27:47 yamt Exp $
< $NetBSD: vfs_syscalls.c,v 1.225 2005/07/10 14:26:02 cube Exp $
> $NetBSD: vfs_syscalls.c,v 1.226 2005/07/16 22:47:18 christos Exp $
< $NetBSD: vfs_vnops.c,v 1.92 2005/06/19 18:22:36 elad Exp $
> $NetBSD: vfs_vnops.c,v 1.93 2005/07/16 22:47:18 christos Exp $
< $NetBSD: vnd.c,v 1.114 2005/03/31 18:02:16 bouyer Exp $
> $NetBSD: vnd.c,v 1.117 2005/07/18 16:36:29 christos Exp $
< $NetBSD: wi.c,v 1.205 2005/07/14 00:28:51 dyoung Exp $
> $NetBSD: wi.c,v 1.207 2005/07/16 04:06:39 yamt Exp $
< $Revision: 1.685 $
< /netbsd.GENERIC.old:
> $Revision: 1.689 $
> /netbsd.GENERIC:
--CUfgB8w4ZwR/yMy5--