#
# Common parameter parsing for pktgen scripts
#
function usage() {
echo ""
echo "Usage: $0 [-vx] -i ethX"
echo " -i : (\$DEV) output interface/device (required)"
echo " -s : (\$PKT_SIZE) packet size"
echo " -d : (\$DEST_IP) destination IP"
echo " -m : (\$DST_MAC) destination MAC-addr"
echo " -t : (\$THREADS) threads to start"
echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB"
echo " -b : (\$BURST) HW level bursting of SKBs"
echo " -v : (\$VERBOSE) verbose"
echo " -x : (\$DEBUG) debug"
echo " -6 : (\$IP6) IPv6"
echo ""
}
## --- Parse command line arguments / parameters ---
## echo "Commandline options:"
while getopts "s:i:d:m:t:c:b:vxh6" option; do
case $option in
i) # interface
export DEV=$OPTARG
info "Output device set to: DEV=$DEV"
;;
s)
export PKT_SIZE=$OPTARG
info "Packet size set to: PKT_SIZE=$PKT_SIZE bytes"
;;
d) # destination IP
export DEST_IP=$OPTARG
info "Destination IP set to: DEST_IP=$DEST_IP"
;;
m) # MAC
export DST_MAC=$OPTARG
info "Destination MAC set to: DST_MAC=$DST_MAC"
;;
t)
export THREADS=$OPTARG
export CPU_THREADS=$OPTARG
let "CPU_THREADS -= 1"
info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
;;
c)
export CLONE_SKB=$OPTARG
info "CLONE_SKB=$CLONE_SKB"
;;
b)
export BURST=$OPTARG
info "SKB bursting: BURST=$BURST"
;;
v)
export VERBOSE=yes
info "Verbose mode: VERBOSE=$VERBOSE"
;;
x)
export DEBUG=yes
info "Debug mode: DEBUG=$DEBUG"
;;
6)
export IP6=6
info "IP6: IP6=$IP6"
;;
h|?|*)
usage;
err 2 "[ERROR] Unknown parameters!!!"
esac
done
shift $(( $OPTIND - 1 ))
if [ -z "$PKT_SIZE" ]; then
# NIC adds 4 bytes CRC
export PKT_SIZE=60
info "Default packet size set to: set to: $PKT_SIZE bytes"
fi
if [ -z "$THREADS" ]; then
# Zero CPU threads means one thread, because CPU numbers are zero indexed
export CPU_THREADS=0
export THREADS=1
fi
if [ -z "$DEV" ]; then
usage
err 2 "Please specify output device"
fi
if [ -z "$DST_MAC" ]; then
warn "Missing destination MAC address"
fi
if [ -z "$DEST_IP" ]; then
warn "Missing destination IP address"
fi
if [ ! -d /proc/net/pktgen ]; then
info "Loading kernel module: pktgen"
modprobe pktgen
fi
perf/x86/intel/rapl: Make package handling more robust
The package management code in RAPL relies on package mapping being
available before a CPU is started. This changed with:
9d85eb9119f4 ("x86/smpboot: Make logical package management more robust")
because the ACPI/BIOS information turned out to be unreliable, but that
left RAPL in broken state. This was not noticed because on a regular boot
all CPUs are online before RAPL is initialized.
A possible fix would be to reintroduce the mess which allocates a package
data structure in CPU prepare and when it turns out to already exist in
starting throw it away later in the CPU online callback. But that's a
horrible hack and not required at all because RAPL becomes functional for
perf only in the CPU online callback. That's correct because user space is
not yet informed about the CPU being onlined, so nothing caan rely on RAPL
being available on that particular CPU.
Move the allocation to the CPU online callback and simplify the hotplug
handling. At this point the package mapping is established and correct.
This also adds a missing check for available package data in the
event_init() function.
Reported-by: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Stephane Eranian <eranian@google.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 9d85eb9119f4 ("x86/smpboot: Make logical package management more robust")
Link: http://lkml.kernel.org/r/20170131230141.212593966@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>