Revision 71e7bc2bab77e64882c031c2af943c3256c1adb0 authored by David Carrillo-Cisneros on 17 August 2016, 20:55:04 UTC, committed by Ingo Molnar on 18 August 2016, 08:35:52 UTC
The call to smp_call_function_single in perf_event_read() may fail if
an invalid or not online CPU index is passed. Warn user if such bug is
present and return error.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/1471467307-61171-2-git-send-email-davidcc@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 99f5bc9
Raw File
scsi_tcq.h
#ifndef _SCSI_SCSI_TCQ_H
#define _SCSI_SCSI_TCQ_H

#include <linux/blkdev.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>

#define SCSI_NO_TAG	(-1)    /* identify no tag in use */


#ifdef CONFIG_BLOCK
/**
 * scsi_host_find_tag - find the tagged command by host
 * @shost:	pointer to scsi_host
 * @tag:	tag
 *
 * Note: for devices using multiple hardware queues tag must have been
 * generated by blk_mq_unique_tag().
 **/
static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
		int tag)
{
	struct request *req = NULL;

	if (tag == SCSI_NO_TAG)
		return NULL;

	if (shost_use_blk_mq(shost)) {
		u16 hwq = blk_mq_unique_tag_to_hwq(tag);

		if (hwq < shost->tag_set.nr_hw_queues) {
			req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
				blk_mq_unique_tag_to_tag(tag));
		}
	} else {
		req = blk_map_queue_find_tag(shost->bqt, tag);
	}

	if (!req)
		return NULL;
	return req->special;
}

#endif /* CONFIG_BLOCK */
#endif /* _SCSI_SCSI_TCQ_H */
back to top