Don't hold kernel lock across call to ip_input() -- it blocked *all*

hardware interrupts for the length of time it took for all dequeued
packets to flow up the stack (on multiprocessors only).  Initial testing
shows performance impact is minimal -- since this temporary fix actually
means taking/releasing the kernel lock per-packet, that seems
acceptable.

Holding the kernel lock across the ip_input() call duplicated the
exclusion intended to be provided by the socket locks/softnet lock
(same lock, for INET/INET6 sockets) and could mask serious bugs.  Several
hours' testing didn't turn any up but I'd be surprised if some don't now
appear.

Damon Permezel noticed the problem.  Temporary fix suggested by matt@.
This commit is contained in:
tls 2010-03-31 07:31:15 +00:00
parent 061c4b41cb
commit 4e65861033
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.284 2009/09/16 15:23:05 pooka Exp $ */
/* $NetBSD: ip_input.c,v 1.285 2010/03/31 07:31:15 tls Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.284 2009/09/16 15:23:05 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.285 2010/03/31 07:31:15 tls Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -483,7 +483,9 @@ ipintr(void)
splx(s);
if (m == NULL)
break;
KERNEL_UNLOCK_ONE(NULL);
ip_input(m);
KERNEL_LOCK(1, NULL);
}
KERNEL_UNLOCK_ONE(NULL);
mutex_exit(softnet_lock);