#!/usr/bin/env python data = {} times = [] threads = [] cpus = [] def get_key(time, event, cpu, thread): return "%d-%s-%d-%d" % (time, event, cpu, thread) def store_key(time, cpu, thread): if (time not in times): times.append(time) if (cpu not in cpus): cpus.append(cpu) if (thread not in threads): threads.append(thread) def store(time, event, cpu, thread, val, ena, run): #print "event %s cpu %d, thread %d, time %d, val %d, ena %d, run %d" % \ # (event, cpu, thread, time, val, ena, run) store_key(time, cpu, thread) key = get_key(time, event, cpu, thread) data[key] = [ val, ena, run] def get(time, event, cpu, thread): key = get_key(time, event, cpu, thread) return data[key][0] def stat__cycles_k(cpu, thread, time, val, ena, run): store(time, "cycles", cpu, thread, val, ena, run); def stat__instructions_k(cpu, thread, time, val, ena, run): store(time, "instructions", cpu, thread, val, ena, run); def stat__cycles_u(cpu, thread, time, val, ena, run): store(time, "cycles", cpu, thread, val, ena, run); def stat__instructions_u(cpu, thread, time, val, ena, run): store(time, "instructions", cpu, thread, val, ena, run); def stat__cycles(cpu, thread, time, val, ena, run): store(time, "cycles", cpu, thread, val, ena, run); def stat__instructions(cpu, thread, time, val, ena, run): store(time, "instructions", cpu, thread, val, ena, run); def stat__interval(time): for cpu in cpus: for thread in threads: cyc = get(time, "cycles", cpu, thread) ins = get(time, "instructions", cpu, thread) cpi = 0 if ins != 0: cpi = cyc/float(ins) print "%15f: cpu %d, thread %d -> cpi %f (%d/%d)" % (time/(float(1000000000)), cpu, thread, cpi, cyc, ins) def trace_end(): pass # XXX trace_end callback could be used as an alternative place # to compute same values as in the script above: # # for time in times: # for cpu in cpus: # for thread in threads: # cyc = get(time, "cycles", cpu, thread) # ins = get(time, "instructions", cpu, thread) # # if ins != 0: # cpi = cyc/float(ins) # # print "time %.9f, cpu %d, thread %d -> cpi %f" % (time/(float(1000000000)), cpu, thread, cpi) tion='/cgit.cgi/linux/net-next.git/log/sound/usb/6fire/control.c'>
path: root/sound/usb/6fire/control.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-01-30 13:15:41 +0100
committerBjorn Helgaas <bhelgaas@google.com>2017-02-02 10:35:46 -0600
commitdfef358bd1beb4e7b5c94eca944be9cd23dfc752 (patch)
treeb9a2afb38a4c2ac8ad31f49ec0d71fe9e5b1994c /sound/usb/6fire/control.c
parent030305d69fc6963c16003f50d7e8d74b02d0a143 (diff)
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>
Diffstat (limited to 'sound/usb/6fire/control.c')