NetBSD Problem Report #45177

From kardel@pip.acrys.com  Sun Jul 24 18:17:33 2011
Return-Path: <kardel@pip.acrys.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id D8F6B63BE64
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 24 Jul 2011 18:17:32 +0000 (UTC)
Message-Id: <201107241817.p6OIHNNT002385@pip.acrys.com>
Date: Sun, 24 Jul 2011 20:17:23 +0200 (MEST)
From: kardel@pip.acrys.com
Reply-To: kardel@pip.acrys.com
To: gnats-bugs@gnats.NetBSD.org
Subject: DIAGNOSTIC panic: arch/x86/x86/pmap.c:3215: KASSERT(uvm_page_locked_p(pg)) fails
X-Send-Pr-Version: 3.95

>Number:         45177
>Category:       kern
>Synopsis:       DIAGNOSTIC panic: arch/x86/x86/pmap.c:3215: KASSERT(uvm_page_locked_p(pg)) fails
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 24 18:20:00 +0000 2011
>Closed-Date:    Wed Aug 31 22:18:33 +0000 2011
>Last-Modified:  Wed Aug 31 22:20:01 +0000 2011
>Originator:     Frank Kardel
>Release:        NetBSD 5.99.55
>Organization:

>Environment:


System: NetBSD pip.kardel.name 5.99.55 NetBSD 5.99.55 (PIPGEN) #43: Mon Jun 13 09:18:54 MEST 2011 kardel@pip.kardel.name:/fs/raid1a/src/NetBSD/tc-merge/obj.amd64/sys/arch/amd64/compile/PIPGEN amd64
Architecture: amd64
Machine: amd64
>Description:
	With 5.99.55 amd64 I started to get KASSERT(uvm_page_locked_p(pg) panics from postgresql running in i386 emulation mode. 5.99.54 didn't seen to sensible.

	Hand copied stack trace:
	panic in arch/x86/x86/pmap.c:3215 ($NetBSD: pmap.c,v 1.127 2011/07/05 14:07:12 yamt Exp $)
	pmap_remove_pte
	pmap_remove
	genfs_directio
	ffs_write

	postgresql opens files with O_DIRECT. 
>How-To-Repeat:
	run "ANALYZE VERBOSE" on a large table with postgresql(i386) and amd64 5.99.55. Sometimes the panic also happens at startup of postgresql.

This issue is already being discussed and J. Hannken-Illjes wrote a simpler testcase:


#include <sys/mman.h>
#include <assert.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>

#define FNAME "/var/tmp/testfile"
#define FSIZE 1048576

int
main(int argc, char **argv)
{
	int fd;
	char *buf;

	buf = mmap(NULL, FSIZE, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
	assert(buf != MAP_FAILED);
	memset(buf, 0, FSIZE);

	fd = open(FNAME, O_RDWR | O_CREAT | O_DIRECT, 0666);
	assert(fd >= 0);

	assert(pwrite(fd, buf, FSIZE, 0) != -1);
	assert(pwrite(fd, buf, 8192, 548864) != -1);

	return 0;
}

yamt notes that vp->v_interlock is a wrong lock to take for genfs_do_directio.

>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: rmind@NetBSD.org
State-Changed-When: Wed, 31 Aug 2011 22:18:33 +0000
State-Changed-Why:
Fixed.


From: "Mindaugas Rasiukevicius" <rmind@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45177 CVS commit: src/sys/miscfs/genfs
Date: Wed, 31 Aug 2011 22:16:54 +0000

 Module Name:	src
 Committed By:	rmind
 Date:		Wed Aug 31 22:16:54 UTC 2011

 Modified Files:
 	src/sys/miscfs/genfs: genfs_io.c

 Log Message:
 genfs_do_directio: acquire the lock of page owner for now and fix PR/45177.
 Will be revisited to avoid locking dance and be more efficient, e.g. we can
 use unmanaged-mapping by allocating with colouring in mind.


 To generate a diff of this commit:
 cvs rdiff -u -r1.49 -r1.50 src/sys/miscfs/genfs/genfs_io.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.