#!/bin/sh
# description: Test creation and deletion of trace instances while setting an event
if [ ! -d instances ] ; then
echo "no instance directory with this kernel"
exit_unsupported;
fi
fail() { # mesg
rmdir foo 2>/dev/null
echo $1
set -e
exit $FAIL
}
cd instances
# we don't want to fail on error
set +e
mkdir x
rmdir x
result=$?
if [ $result -ne 0 ]; then
echo "instance rmdir not supported"
exit_unsupported
fi
instance_slam() {
while :; do
mkdir foo 2> /dev/null
rmdir foo 2> /dev/null
done
}
instance_read() {
while :; do
cat foo/trace 1> /dev/null 2>&1
done
}
instance_set() {
while :; do
echo 1 > foo/events/sched/sched_switch
done 2> /dev/null
}
instance_slam &
p1=$!
echo $p1
instance_set &
p2=$!
echo $p2
instance_read &
p3=$!
echo $p3
sleep 1
kill -1 $p3
kill -1 $p2
kill -1 $p1
echo "Wait for processes to finish"
wait $p1 $p2 $p3
echo "all processes finished, wait for cleanup"
sleep 1
mkdir foo
ls foo > /dev/null
rmdir foo
if [ -d foo ]; then
fail "foo still exists"
fi
exit 0
instance_slam() {
while :; do
mkdir x
mkdir y
mkdir z
rmdir x
rmdir y
rmdir z
done 2>/dev/null
}
instance_slam &
p1=$!
echo $p1
instance_slam &
p2=$!
echo $p2
instance_slam &
p3=$!
echo $p3
instance_slam &
p4=$!
echo $p4
instance_slam &
p5=$!
echo $p5
ls -lR >/dev/null
sleep 1
kill -1 $p1
kill -1 $p2
kill -1 $p3
kill -1 $p4
kill -1 $p5
echo "Wait for processes to finish"
wait $p1 $p2 $p3 $p4 $p5
echo "all processes finished, wait for cleanup"
mkdir x y z
ls x y z
rmdir x y z
for d in x y z; do
if [ -d $d ]; then
fail "instance $d still exists"
fi
done
set -e
exit 0
t-next.git/tree/drivers/usb/misc/uss720.c?h=nds-private-remove&id=f7d6040aa45df6ffd9e891114125dc919f18b96b'>treecommitdiff
PCI/MSI: Don't apply affinity if there aren't enough vectors left
Bart reported a problem wіth an out of bounds access in the low-level IRQ
affinity code, which we root caused to the qla2xxx driver assigning all its
MSI-X vectors to the pre and post vectors, and not having any left for the
actually spread IRQs.
Fix this issue by not asking for affinity assignment when there are no
vectors to assign left.
Fixes: 402723ad5c62 ("PCI/MSI: Provide pci_alloc_irq_vectors_affinity()")
Link: https://lkml.kernel.org/r/1485359225.3093.3.camel@sandisk.com
Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Tested-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>