2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

Merge "citrix" branch into "master".

This merge is long overdue, simply because I forgot that there were
outstanding changes on "citrix" that had not yet been merged.

The important fix here is the addition of mlockall.  This fixes some
bugs seen under stressful conditions in XenServer.
This commit is contained in:
Ben Pfaff 2010-03-25 12:30:05 -07:00
commit a0bc29a541
6 changed files with 45 additions and 2 deletions

View File

@ -12,6 +12,11 @@ v0.99.0 - 14 Jan 2010
--------------------- ---------------------
- User-space forwarding engine - User-space forwarding engine
- Bug fixes - Bug fixes
v0.90.7 - 29 Nov 2009
---------------------
- Add support for NetFlow active timeouts
- Bug fixes
v0.90.6 - 6 Oct 2009 v0.90.6 - 6 Oct 2009
-------------------- --------------------

View File

@ -53,6 +53,7 @@ OVS_CHECK_IF_PACKET
OVS_CHECK_STRTOK_R OVS_CHECK_STRTOK_R
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec], AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec],
[], [], [[#include <sys/stat.h>]]) [], [], [[#include <sys/stat.h>]])
AC_CHECK_FUNCS([mlockall])
OVS_CHECK_PKIDIR OVS_CHECK_PKIDIR
OVS_CHECK_RUNDIR OVS_CHECK_RUNDIR

View File

@ -74,6 +74,17 @@ Open vSwitch distribution for instructions on how to build and load
the Open vSwitch kernel module. the Open vSwitch kernel module.
.PP .PP
.SH OPTIONS .SH OPTIONS
.IP "\fB--mlockall\fR"
Causes \fBovs\-vswitchd\fR to call the \fBmlockall()\fR function, to
attempt to lock all of its process memory into physical RAM,
preventing the kernel from paging any of its memory to disk. This
helps to avoid networking interruptions due to system memory pressure.
.IP
Some systems do not support \fBmlockall()\fR at all, and other systems
only allow privileged users, such as the superuser, to use it.
\fBovs\-vswitchd\fR emits a log message if \fBmlockall()\fR is
unavailable or unsuccessful.
.
.IP "\fB--fake-proc-net\fR" .IP "\fB--fake-proc-net\fR"
Causes \fBovs\-vswitchd\fR to simulate some files in \fB/proc/net/vlan\fR Causes \fBovs\-vswitchd\fR to simulate some files in \fB/proc/net/vlan\fR
and \fB/proc/net/bonding\fR that some legacy software expects to and \fB/proc/net/bonding\fR that some legacy software expects to

View File

@ -22,6 +22,9 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef HAVE_MLOCKALL
#include <sys/mman.h>
#endif
#include "bridge.h" #include "bridge.h"
#include "command-line.h" #include "command-line.h"
@ -136,6 +139,7 @@ parse_options(int argc, char *argv[])
{ {
enum { enum {
OPT_PEER_CA_CERT = UCHAR_MAX + 1, OPT_PEER_CA_CERT = UCHAR_MAX + 1,
OPT_MLOCKALL,
OPT_FAKE_PROC_NET, OPT_FAKE_PROC_NET,
VLOG_OPTION_ENUMS, VLOG_OPTION_ENUMS,
LEAK_CHECKER_OPTION_ENUMS, LEAK_CHECKER_OPTION_ENUMS,
@ -144,6 +148,7 @@ parse_options(int argc, char *argv[])
static struct option long_options[] = { static struct option long_options[] = {
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
{"mlockall", no_argument, 0, OPT_MLOCKALL},
{"fake-proc-net", no_argument, 0, OPT_FAKE_PROC_NET}, {"fake-proc-net", no_argument, 0, OPT_FAKE_PROC_NET},
DAEMON_LONG_OPTIONS, DAEMON_LONG_OPTIONS,
VLOG_LONG_OPTIONS, VLOG_LONG_OPTIONS,
@ -175,6 +180,16 @@ parse_options(int argc, char *argv[])
OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION); OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
case OPT_MLOCKALL:
#ifdef HAVE_MLOCKALL
if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
VLOG_ERR("mlockall failed: %s", strerror(errno));
}
#else
VLOG_ERR("mlockall not supported on this system");
#endif
break;
case OPT_FAKE_PROC_NET: case OPT_FAKE_PROC_NET:
error = proc_net_compat_init(); error = proc_net_compat_init();
if (error) { if (error) {

View File

@ -50,6 +50,7 @@ test -e /etc/sysconfig/vswitch && . /etc/sysconfig/vswitch
: ${VSWITCHD_PIDFILE:=/var/run/ovs-vswitchd.pid} : ${VSWITCHD_PIDFILE:=/var/run/ovs-vswitchd.pid}
: ${VSWITCHD_RUN_DIR:=/var/xen/vswitch} : ${VSWITCHD_RUN_DIR:=/var/xen/vswitch}
: ${VSWITCHD_PRIORITY:=-10} : ${VSWITCHD_PRIORITY:=-10}
: ${VSWITCHD_MLOCKALL:=yes}
: ${VSWITCHD_LOGFILE:=/var/log/ovs-vswitchd.log} : ${VSWITCHD_LOGFILE:=/var/log/ovs-vswitchd.log}
: ${VSWITCHD_FILE_LOGLEVEL:=INFO} : ${VSWITCHD_FILE_LOGLEVEL:=INFO}
: ${VSWITCHD_SYSLOG_LOGLEVEL:=ERR} : ${VSWITCHD_SYSLOG_LOGLEVEL:=ERR}
@ -218,12 +219,15 @@ function start_vswitchd {
if [ "$ENABLE_FAKE_PROC_NET" = "y" ]; then if [ "$ENABLE_FAKE_PROC_NET" = "y" ]; then
fake_proc_net_opt="--fake-proc-net" fake_proc_net_opt="--fake-proc-net"
fi fi
if [ "$VSWITCHD_MLOCKALL" != "no" ]; then
mlockall_opt="--mlockall"
fi
if [ "$daemonize" != "y" ]; then if [ "$daemonize" != "y" ]; then
# Start in background and force a "success" message # Start in background and force a "success" message
action "Starting ovs-vswitchd ($strace_opt$valgrind_opt)" true action "Starting ovs-vswitchd ($strace_opt$valgrind_opt)" true
(nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach $monitor_opt --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER") & (nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach $monitor_opt --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $mlockall_opt "$VSWITCHD_OVSDB_SERVER") &
else else
action "Starting ovs-vswitchd" nice -n "$VSWITCHD_PRIORITY" "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach $monitor_opt --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER" action "Starting ovs-vswitchd" nice -n "$VSWITCHD_PRIORITY" "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach $monitor_opt --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $mlockall_opt "$VSWITCHD_OVSDB_SERVER"
fi fi
} }

View File

@ -117,6 +117,13 @@
# processes. # processes.
# VSWITCHD_PRIORITY=-10 # VSWITCHD_PRIORITY=-10
# VSWITCHD_MLOCKALL: Whether to pass ovs-vswitchd the --mlockall option.
# This option should be set to "yes" or "no". The default is "yes".
# Enabling this option can avoid networking interruptions due to
# system memory pressure in extraordinary situations, such as multiple
# concurrent VM import operations.
# VSWITCHD_MLOCKALL=yes
# VSWITCHD_LOGFILE: File to send the FILE_LOGLEVEL log messages to. # VSWITCHD_LOGFILE: File to send the FILE_LOGLEVEL log messages to.
# VSWITCHD_LOGFILE=/var/log/ovs-vswitchd.log # VSWITCHD_LOGFILE=/var/log/ovs-vswitchd.log