[ovs-discuss] OpenvSwitch 1.0.1 on XenServer 5.6 with Bonding

Ben Pfaff blp at nicira.com
Wed Aug 25 20:03:43 UTC 2010


On Wed, Aug 25, 2010 at 01:03:16PM -0700, Ben Pfaff wrote:
> On Wed, Aug 25, 2010 at 02:53:05PM -0300, Luiz Henrique Ozaki wrote:
> > I'm trying to create a bond interface with OpenvSwitch in a XenServer 5.6
> > and I'm getting a high load CPU for the ovs-vswitchd, but It's working
> > apparently.
> 
> Hi Luiz.  This shouldn't happen.
> 
> When the vswitch is in this high-CPU consumption state, please turn on
> poll_loop debugging with "ovs-appctl vlog/set poll_loop".  This should
> output a bunch of extra DBG messages for the poll_loop module to the
> log.  Then please run the log through the ovs-backtrace script that I'm
> appending, supplying a binary with debug symbols as its argument and the
> log as the input, and pass along the output.  This will probably help to
> identify the problem.

Here's the script:

#! /usr/bin/perl -w

use strict;

# Check command line.
if (grep ($_ eq '-h' || $_ eq '--help', @ARGV)) {
    print <<'EOF';
backtrace, for converting raw addresses into symbolic backtraces
usage: $0 BINARY... < LOG
       $0 BINARY... ADDRESS...
where BINARY is the binary file or files from which to obtain symbols
  and ADDRESS is an address to translate (beginning with "0x")
   or LOG contains addresses to translate.

At least one BINARY must be specified.
EOF
    exit 0;
}
die "backtrace: at least one argument required (use --help for help)\n"
    if @ARGV == 0;

# Find binaries.
our @binaries;
my @addresses;
for my $arg (@ARGV) {
    if (-e $arg) {
        push(@binaries, $arg);
    } elsif ($arg =~ /^(0x)?[0-9a-fA-F]+/) {
        push(@addresses, $arg);
    } else {
        die "backtrace: $arg: not found (use --help for help)\n";
    }
}
if (!@binaries) {
    die "backtrace: no binary specified (use --help for help)\n";
}

# Find addr2line.
my ($a2l) = search_path ("i386-elf-addr2line") || search_path ("addr2line");
if (!$a2l) {
    die "backtrace: neither `i386-elf-addr2line' nor `addr2line' in PATH\n";
}
sub search_path {
    my ($target) = @_;
    for my $dir (split (':', $ENV{PATH})) {
	my ($file) = "$dir/$target";
	return $file if -e $file;
    }
    return undef;
}

our %cache;
sub translate {
    my ($address) = @_;

    if (defined($cache{$address})) {
        return %{$cache{$address}};
    }

    my %translation;
    for my $bin (@binaries) {

        my ($function, $line);
        open(A2L, "$a2l -fsie $bin $address|");
        chomp($function = <A2L>);
        chomp($line = <A2L>);
        close(A2L);

        if ($function ne '??' || $line ne '??:0') {
            $translation{FUNCTION} = $function;
            $translation{LINE} = $line;
            $translation{BINARY} = $bin;
            last;
        }
    }
    $cache{$address} = \%translation;

    return %translation;
}

if (@addresses) {
    # Print backtrace.
    my ($cur_binary);
    for my $addr (@addresses) {
        my %loc = translate($addr);
        if (defined ($loc{BINARY})
            && @binaries > 1
            && (!defined ($cur_binary) || $loc{BINARY} ne $cur_binary)) {
            $cur_binary = $loc{BINARY};
            print "In $cur_binary:\n";
        }

        $addr = sprintf ("0x%08x", hex ($addr)) if $addr =~ /^0x[0-9a-f]+$/i;

        print $addr, ": ";
        if (defined ($loc{BINARY})) {
            my ($function) = $loc{FUNCTION};
            my ($line) = $loc{LINE};
            $line =~ s/^(\.\.\/)*//;
            $line = "..." . substr ($line, -25) if length ($line) > 28;
            print "$function ($line)";
        } else {
            print "(unknown)";
        }
        print "\n";
    }
    exit(0);
}

sub translate_address {
    my ($address) = @_;
    my %loc = translate($address);
    my ($s) = $address;
    if (defined($loc{BINARY})) {
        $s .= "($loc{FUNCTION})" if $loc{FUNCTION} ne '??';
        $s .= "($loc{LINE})" if $loc{LINE} ne '??:0';
    }
    return $s;
}

while (<STDIN>) {
    chomp;
    if (/poll_loop.*0x|backtrace/) {
        s/(0x[0-9a-fA-F]+)/translate_address($1)/ge;
    }
    print "$_\n";
}




More information about the discuss mailing list