History

genirq/affinity: Store interrupt sets size in struct irq_affinity

The interrupt affinity spreading mechanism supports to spread out affinities for one or more interrupt sets. A interrupt set contains one or more interrupts. Each set is mapped to a specific functionality of a device, e.g. general I/O queues and read I/O queus of multiqueue block devices. The number of interrupts per set is defined by the driver. It depends on the total number of available interrupts for the device, which is determined by the PCI capabilites and the availability of underlying CPU resources, and the number of queues which the device provides and the driver wants to instantiate. The driver passes initial configuration for the interrupt allocation via a pointer to struct irq_affinity. Right now the allocation mechanism is complex as it requires to have a loop in the driver to determine the maximum number of interrupts which are provided by the PCI capabilities and the underlying CPU resources. This loop would have to be replicated in every driver which wants to utilize this mechanism. That's unwanted code duplication and error prone. In order to move this into generic facilities it is required to have a mechanism, which allows the recalculation of the interrupt sets and their size, in the core code. As the core code does not have any knowledge about the underlying device, a driver specific callback will be added to struct affinity_desc, which will be invoked by the core code. The callback will get the number of available interupts as an argument, so the driver can calculate the corresponding number and size of interrupt sets. To support this, two modifications for the handling of struct irq_affinity are required: 1) The (optional) interrupt sets size information is contained in a separate array of integers and struct irq_affinity contains a pointer to it. This is cumbersome and as the maximum number of interrupt sets is small, there is no reason to have separate storage. Moving the size array into struct affinity_desc avoids indirections and makes the code simpler. 2) At the moment the struct irq_affinity pointer which is handed in from the driver and passed through to several core functions is marked 'const'. With the upcoming callback to recalculate the number and size of interrupt sets, it's necessary to remove the 'const' qualifier. Otherwise the callback would not be able to update the data. Implement #1 and store the interrupt sets size in 'struct irq_affinity'. No functional change. [ tglx: Fixed the memcpy() size so it won't copy beyond the size of the source. Fixed the kernel doc comments for struct irq_affinity and de-'This patch'-ed the changelog ]

Ming Lei committed 7 years ago

Commit 9cfef551 parent 0145c303 files · +21 −11Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/interrupt.h+6−3
@@ -241,20 +241,23 @@ struct irq_affinity_notify { · 240 unmodified lines
241241 void (*release)(struct kref *ref);
242242 };
243243
244+#define IRQ_AFFINITY_MAX_SETS 4
245+
244246 /**
245247 * struct irq_affinity - Description for automatic irq affinity assignements
246248 * @pre_vectors: Don't apply affinity to @pre_vectors at beginning of
247249 * the MSI(-X) vector space
248250 * @post_vectors: Don't apply affinity to @post_vectors at end of
249251 * the MSI(-X) vector space
250− * @nr_sets: Length of passed in *sets array
251− * @sets: Number of affinitized sets
252+ * @nr_sets: The number of interrupt sets for which affinity
253+ * spreading is required
254+ * @set_size: Array holding the size of each interrupt set
252255 */
253256 struct irq_affinity {
254257 unsigned int pre_vectors;
255258 unsigned int post_vectors;
256259 unsigned int nr_sets;
257− unsigned int *sets;
260+ unsigned int set_size[IRQ_AFFINITY_MAX_SETS];
258261 };
259262
260263 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t