Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-5.10b-rc1c-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull more xen updates from Juergen Gross:

- a series for the Xen pv block drivers adding module parameters for
better control of resource usge

- a cleanup series for the Xen event driver

* tag 'for-linus-5.10b-rc1c-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
Documentation: add xen.fifo_events kernel parameter description
xen/events: unmask a fifo event channel only if it was masked
xen/events: only register debug interrupt for 2-level events
xen/events: make struct irq_info private to events_base.c
xen: remove no longer used functions
xen-blkfront: Apply changed parameter name to the document
xen-blkfront: add a parameter for disabling of persistent grants
xen-blkback: add a parameter for disabling of persistent grants

+152 -126
+9
Documentation/ABI/testing/sysfs-driver-xen-blkback
··· 35 35 controls the duration in milliseconds that blkback will not 36 36 cache any page not backed by a grant mapping. 37 37 The default is 10ms. 38 + 39 + What: /sys/module/xen_blkback/parameters/feature_persistent 40 + Date: September 2020 41 + KernelVersion: 5.10 42 + Contact: SeongJae Park <sjpark@amazon.de> 43 + Description: 44 + Whether to enable the persistent grants feature or not. Note 45 + that this option only takes effect on newly created backends. 46 + The default is Y (enable).
+10 -1
Documentation/ABI/testing/sysfs-driver-xen-blkfront
··· 1 - What: /sys/module/xen_blkfront/parameters/max 1 + What: /sys/module/xen_blkfront/parameters/max_indirect_segments 2 2 Date: June 2013 3 3 KernelVersion: 3.11 4 4 Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> ··· 8 8 is 32 - higher value means more potential throughput but more 9 9 memory usage. The backend picks the minimum of the frontend 10 10 and its default backend value. 11 + 12 + What: /sys/module/xen_blkfront/parameters/feature_persistent 13 + Date: September 2020 14 + KernelVersion: 5.10 15 + Contact: SeongJae Park <sjpark@amazon.de> 16 + Description: 17 + Whether to enable the persistent grants feature or not. Note 18 + that this option only takes effect on newly created frontends. 19 + The default is Y (enable).
+7
Documentation/admin-guide/kernel-parameters.txt
··· 5978 5978 After which time (jiffies) the event handling loop 5979 5979 should start to delay EOI handling. Default is 2. 5980 5980 5981 + xen.fifo_events= [XEN] 5982 + Boolean parameter to disable using fifo event handling 5983 + even if available. Normally fifo event handling is 5984 + preferred over the 2-level event handling, as it is 5985 + fairer and the number of possible event channels is 5986 + much higher. Default is on (use fifo events). 5987 + 5981 5988 nopv= [X86,XEN,KVM,HYPER_V,VMWARE] 5982 5989 Disables the PV optimizations forcing the guest to run 5983 5990 as generic guest with no PV drivers. Currently support
+11 -8
arch/x86/xen/smp.c
··· 88 88 per_cpu(xen_callfunc_irq, cpu).irq = rc; 89 89 per_cpu(xen_callfunc_irq, cpu).name = callfunc_name; 90 90 91 - debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); 92 - rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, 93 - IRQF_PERCPU | IRQF_NOBALANCING, 94 - debug_name, NULL); 95 - if (rc < 0) 96 - goto fail; 97 - per_cpu(xen_debug_irq, cpu).irq = rc; 98 - per_cpu(xen_debug_irq, cpu).name = debug_name; 91 + if (!xen_fifo_events) { 92 + debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); 93 + rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, 94 + xen_debug_interrupt, 95 + IRQF_PERCPU | IRQF_NOBALANCING, 96 + debug_name, NULL); 97 + if (rc < 0) 98 + goto fail; 99 + per_cpu(xen_debug_irq, cpu).irq = rc; 100 + per_cpu(xen_debug_irq, cpu).name = debug_name; 101 + } 99 102 100 103 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); 101 104 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
+2
arch/x86/xen/xen-ops.h
··· 29 29 extern struct shared_info xen_dummy_shared_info; 30 30 extern struct shared_info *HYPERVISOR_shared_info; 31 31 32 + extern bool xen_fifo_events; 33 + 32 34 void xen_setup_mfn_list_list(void); 33 35 void xen_build_mfn_list_list(void); 34 36 void xen_setup_machphys_mapping(void);
+16 -6
drivers/block/xen-blkback/xenbus.c
··· 473 473 vbd->bdev = NULL; 474 474 } 475 475 476 + /* Enable the persistent grants feature. */ 477 + static bool feature_persistent = true; 478 + module_param(feature_persistent, bool, 0644); 479 + MODULE_PARM_DESC(feature_persistent, 480 + "Enables the persistent grants feature"); 481 + 476 482 static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, 477 483 unsigned major, unsigned minor, int readonly, 478 484 int cdrom) ··· 523 517 524 518 if (q && blk_queue_secure_erase(q)) 525 519 vbd->discard_secure = true; 520 + 521 + vbd->feature_gnt_persistent = feature_persistent; 526 522 527 523 pr_debug("Successful creation of handle=%04x (dom=%u)\n", 528 524 handle, blkif->domid); ··· 913 905 914 906 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); 915 907 916 - err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1); 908 + err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 909 + be->blkif->vbd.feature_gnt_persistent); 917 910 if (err) { 918 911 xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", 919 912 dev->nodename); ··· 1075 1066 { 1076 1067 struct xenbus_device *dev = be->dev; 1077 1068 struct xen_blkif *blkif = be->blkif; 1078 - unsigned int pers_grants; 1079 1069 char protocol[64] = ""; 1080 1070 int err, i; 1081 1071 char *xspath; ··· 1100 1092 xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); 1101 1093 return -ENOSYS; 1102 1094 } 1103 - pers_grants = xenbus_read_unsigned(dev->otherend, "feature-persistent", 1104 - 0); 1105 - blkif->vbd.feature_gnt_persistent = pers_grants; 1095 + if (blkif->vbd.feature_gnt_persistent) 1096 + blkif->vbd.feature_gnt_persistent = 1097 + xenbus_read_unsigned(dev->otherend, 1098 + "feature-persistent", 0); 1099 + 1106 1100 blkif->vbd.overflow_max_grants = 0; 1107 1101 1108 1102 /* ··· 1127 1117 1128 1118 pr_info("%s: using %d queues, protocol %d (%s) %s\n", dev->nodename, 1129 1119 blkif->nr_rings, blkif->blk_protocol, protocol, 1130 - pers_grants ? "persistent grants" : ""); 1120 + blkif->vbd.feature_gnt_persistent ? "persistent grants" : ""); 1131 1121 1132 1122 ring_page_order = xenbus_read_unsigned(dev->otherend, 1133 1123 "ring-page-order", 0);
+15 -5
drivers/block/xen-blkfront.c
··· 1866 1866 message = "writing protocol"; 1867 1867 goto abort_transaction; 1868 1868 } 1869 - err = xenbus_printf(xbt, dev->nodename, 1870 - "feature-persistent", "%u", 1); 1869 + err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1870 + info->feature_persistent); 1871 1871 if (err) 1872 1872 dev_warn(&dev->dev, 1873 1873 "writing persistent grants feature to xenbus"); ··· 1941 1941 } 1942 1942 return 0; 1943 1943 } 1944 + 1945 + /* Enable the persistent grants feature. */ 1946 + static bool feature_persistent = true; 1947 + module_param(feature_persistent, bool, 0644); 1948 + MODULE_PARM_DESC(feature_persistent, 1949 + "Enables the persistent grants feature"); 1950 + 1944 1951 /** 1945 1952 * Entry point to this code when a new device is created. Allocate the basic 1946 1953 * structures and the ring buffer for communication with the backend, and ··· 2013 2006 mutex_init(&info->mutex); 2014 2007 info->vdevice = vdevice; 2015 2008 info->connected = BLKIF_STATE_DISCONNECTED; 2009 + 2010 + info->feature_persistent = feature_persistent; 2016 2011 2017 2012 /* Front end dir is a number, which is used as the id. */ 2018 2013 info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); ··· 2325 2316 if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) 2326 2317 blkfront_setup_discard(info); 2327 2318 2328 - info->feature_persistent = 2329 - !!xenbus_read_unsigned(info->xbdev->otherend, 2330 - "feature-persistent", 0); 2319 + if (info->feature_persistent) 2320 + info->feature_persistent = 2321 + !!xenbus_read_unsigned(info->xbdev->otherend, 2322 + "feature-persistent", 0); 2331 2323 2332 2324 indirect_segments = xenbus_read_unsigned(info->xbdev->otherend, 2333 2325 "feature-max-indirect-segments", 0);
+4 -3
drivers/xen/events/events_2l.c
··· 47 47 return EVTCHN_2L_NR_CHANNELS; 48 48 } 49 49 50 - static void evtchn_2l_bind_to_cpu(struct irq_info *info, unsigned cpu) 50 + static void evtchn_2l_bind_to_cpu(evtchn_port_t evtchn, unsigned int cpu, 51 + unsigned int old_cpu) 51 52 { 52 - clear_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, info->cpu))); 53 - set_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, cpu))); 53 + clear_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, old_cpu))); 54 + set_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, cpu))); 54 55 } 55 56 56 57 static void evtchn_2l_clear_pending(evtchn_port_t port)
+63 -31
drivers/xen/events/events_base.c
··· 70 70 #undef MODULE_PARAM_PREFIX 71 71 #define MODULE_PARAM_PREFIX "xen." 72 72 73 + /* Interrupt types. */ 74 + enum xen_irq_type { 75 + IRQT_UNBOUND = 0, 76 + IRQT_PIRQ, 77 + IRQT_VIRQ, 78 + IRQT_IPI, 79 + IRQT_EVTCHN 80 + }; 81 + 82 + /* 83 + * Packed IRQ information: 84 + * type - enum xen_irq_type 85 + * event channel - irq->event channel mapping 86 + * cpu - cpu this event channel is bound to 87 + * index - type-specific information: 88 + * PIRQ - vector, with MSB being "needs EIO", or physical IRQ of the HVM 89 + * guest, or GSI (real passthrough IRQ) of the device. 90 + * VIRQ - virq number 91 + * IPI - IPI vector 92 + * EVTCHN - 93 + */ 94 + struct irq_info { 95 + struct list_head list; 96 + struct list_head eoi_list; 97 + short refcnt; 98 + short spurious_cnt; 99 + enum xen_irq_type type; /* type */ 100 + unsigned irq; 101 + evtchn_port_t evtchn; /* event channel */ 102 + unsigned short cpu; /* cpu bound */ 103 + unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */ 104 + unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ 105 + u64 eoi_time; /* Time in jiffies when to EOI. */ 106 + 107 + union { 108 + unsigned short virq; 109 + enum ipi_vector ipi; 110 + struct { 111 + unsigned short pirq; 112 + unsigned short gsi; 113 + unsigned char vector; 114 + unsigned char flags; 115 + uint16_t domid; 116 + } pirq; 117 + } u; 118 + }; 119 + 120 + #define PIRQ_NEEDS_EOI (1 << 0) 121 + #define PIRQ_SHAREABLE (1 << 1) 122 + #define PIRQ_MSI_GROUP (1 << 2) 123 + 73 124 static uint __read_mostly event_loop_timeout = 2; 74 125 module_param(event_loop_timeout, uint, 0644); 75 126 ··· 161 110 /* IRQ <-> IPI mapping */ 162 111 static DEFINE_PER_CPU(int [XEN_NR_IPIS], ipi_to_irq) = {[0 ... XEN_NR_IPIS-1] = -1}; 163 112 164 - int **evtchn_to_irq; 113 + static int **evtchn_to_irq; 165 114 #ifdef CONFIG_X86 166 115 static unsigned long *pirq_eoi_map; 167 116 #endif ··· 241 190 } 242 191 243 192 /* Get info for IRQ */ 244 - struct irq_info *info_for_irq(unsigned irq) 193 + static struct irq_info *info_for_irq(unsigned irq) 245 194 { 246 195 if (irq < nr_legacy_irqs()) 247 196 return legacy_info_ptrs[irq]; ··· 279 228 280 229 irq_clear_status_flags(irq, IRQ_NOREQUEST|IRQ_NOAUTOEN); 281 230 282 - return xen_evtchn_port_setup(info); 231 + return xen_evtchn_port_setup(evtchn); 283 232 } 284 233 285 234 static int xen_irq_info_evtchn_setup(unsigned irq, ··· 402 351 return info_for_irq(irq)->type; 403 352 } 404 353 405 - unsigned cpu_from_irq(unsigned irq) 354 + static unsigned cpu_from_irq(unsigned irq) 406 355 { 407 356 return info_for_irq(irq)->cpu; 408 357 } ··· 442 391 #ifdef CONFIG_SMP 443 392 cpumask_copy(irq_get_affinity_mask(irq), cpumask_of(cpu)); 444 393 #endif 445 - xen_evtchn_port_bind_to_cpu(info, cpu); 394 + xen_evtchn_port_bind_to_cpu(evtchn, cpu, info->cpu); 446 395 447 396 info->cpu = cpu; 448 397 } ··· 796 745 info->evtchn = evtchn; 797 746 bind_evtchn_to_cpu(evtchn, 0); 798 747 799 - rc = xen_evtchn_port_setup(info); 748 + rc = xen_evtchn_port_setup(evtchn); 800 749 if (rc) 801 750 goto err; 802 751 ··· 1196 1145 chip); 1197 1146 } 1198 1147 1199 - int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, 1200 - evtchn_port_t remote_port) 1201 - { 1202 - return bind_interdomain_evtchn_to_irq_chip(remote_domain, remote_port, 1203 - &xen_dynamic_chip); 1204 - } 1205 - EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irq); 1206 - 1207 1148 int bind_interdomain_evtchn_to_irq_lateeoi(unsigned int remote_domain, 1208 1149 evtchn_port_t remote_port) 1209 1150 { ··· 1362 1319 1363 1320 return irq; 1364 1321 } 1365 - 1366 - int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, 1367 - evtchn_port_t remote_port, 1368 - irq_handler_t handler, 1369 - unsigned long irqflags, 1370 - const char *devname, 1371 - void *dev_id) 1372 - { 1373 - return bind_interdomain_evtchn_to_irqhandler_chip(remote_domain, 1374 - remote_port, handler, irqflags, devname, 1375 - dev_id, &xen_dynamic_chip); 1376 - } 1377 - EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irqhandler); 1378 1322 1379 1323 int bind_interdomain_evtchn_to_irqhandler_lateeoi(unsigned int remote_domain, 1380 1324 evtchn_port_t remote_port, ··· 2050 2020 static inline void xen_alloc_callback_vector(void) {} 2051 2021 #endif 2052 2022 2053 - static bool fifo_events = true; 2054 - module_param(fifo_events, bool, 0); 2023 + bool xen_fifo_events = true; 2024 + module_param_named(fifo_events, xen_fifo_events, bool, 0); 2055 2025 2056 2026 static int xen_evtchn_cpu_prepare(unsigned int cpu) 2057 2027 { ··· 2080 2050 int ret = -EINVAL; 2081 2051 evtchn_port_t evtchn; 2082 2052 2083 - if (fifo_events) 2053 + if (xen_fifo_events) 2084 2054 ret = xen_evtchn_fifo_init(); 2085 - if (ret < 0) 2055 + if (ret < 0) { 2086 2056 xen_evtchn_2l_init(); 2057 + xen_fifo_events = false; 2058 + } 2087 2059 2088 2060 xen_cpu_init_eoi(smp_processor_id()); 2089 2061
+6 -3
drivers/xen/events/events_fifo.c
··· 138 138 array_page[i] = 1 << EVTCHN_FIFO_MASKED; 139 139 } 140 140 141 - static int evtchn_fifo_setup(struct irq_info *info) 141 + static int evtchn_fifo_setup(evtchn_port_t port) 142 142 { 143 - evtchn_port_t port = info->evtchn; 144 143 unsigned new_array_pages; 145 144 int ret; 146 145 ··· 185 186 return ret; 186 187 } 187 188 188 - static void evtchn_fifo_bind_to_cpu(struct irq_info *info, unsigned cpu) 189 + static void evtchn_fifo_bind_to_cpu(evtchn_port_t evtchn, unsigned int cpu, 190 + unsigned int old_cpu) 189 191 { 190 192 /* no-op */ 191 193 } ··· 237 237 w = *word; 238 238 239 239 do { 240 + if (!(w & (1 << EVTCHN_FIFO_MASKED))) 241 + return true; 242 + 240 243 if (w & (1 << EVTCHN_FIFO_PENDING)) 241 244 return false; 242 245
+9 -61
drivers/xen/events/events_internal.h
··· 7 7 #ifndef __EVENTS_INTERNAL_H__ 8 8 #define __EVENTS_INTERNAL_H__ 9 9 10 - /* Interrupt types. */ 11 - enum xen_irq_type { 12 - IRQT_UNBOUND = 0, 13 - IRQT_PIRQ, 14 - IRQT_VIRQ, 15 - IRQT_IPI, 16 - IRQT_EVTCHN 17 - }; 18 - 19 - /* 20 - * Packed IRQ information: 21 - * type - enum xen_irq_type 22 - * event channel - irq->event channel mapping 23 - * cpu - cpu this event channel is bound to 24 - * index - type-specific information: 25 - * PIRQ - vector, with MSB being "needs EIO", or physical IRQ of the HVM 26 - * guest, or GSI (real passthrough IRQ) of the device. 27 - * VIRQ - virq number 28 - * IPI - IPI vector 29 - * EVTCHN - 30 - */ 31 - struct irq_info { 32 - struct list_head list; 33 - struct list_head eoi_list; 34 - short refcnt; 35 - short spurious_cnt; 36 - enum xen_irq_type type; /* type */ 37 - unsigned irq; 38 - evtchn_port_t evtchn; /* event channel */ 39 - unsigned short cpu; /* cpu bound */ 40 - unsigned short eoi_cpu; /* EOI must happen on this cpu */ 41 - unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ 42 - u64 eoi_time; /* Time in jiffies when to EOI. */ 43 - 44 - union { 45 - unsigned short virq; 46 - enum ipi_vector ipi; 47 - struct { 48 - unsigned short pirq; 49 - unsigned short gsi; 50 - unsigned char vector; 51 - unsigned char flags; 52 - uint16_t domid; 53 - } pirq; 54 - } u; 55 - }; 56 - 57 - #define PIRQ_NEEDS_EOI (1 << 0) 58 - #define PIRQ_SHAREABLE (1 << 1) 59 - #define PIRQ_MSI_GROUP (1 << 2) 60 - 61 10 struct evtchn_loop_ctrl; 62 11 63 12 struct evtchn_ops { 64 13 unsigned (*max_channels)(void); 65 14 unsigned (*nr_channels)(void); 66 15 67 - int (*setup)(struct irq_info *info); 68 - void (*bind_to_cpu)(struct irq_info *info, unsigned cpu); 16 + int (*setup)(evtchn_port_t port); 17 + void (*bind_to_cpu)(evtchn_port_t evtchn, unsigned int cpu, 18 + unsigned int old_cpu); 69 19 70 20 void (*clear_pending)(evtchn_port_t port); 71 21 void (*set_pending)(evtchn_port_t port); ··· 33 83 34 84 extern const struct evtchn_ops *evtchn_ops; 35 85 36 - extern int **evtchn_to_irq; 37 86 int get_evtchn_to_irq(evtchn_port_t evtchn); 38 87 void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl); 39 88 40 - struct irq_info *info_for_irq(unsigned irq); 41 - unsigned cpu_from_irq(unsigned irq); 42 89 unsigned int cpu_from_evtchn(evtchn_port_t evtchn); 43 90 44 91 static inline unsigned xen_evtchn_max_channels(void) ··· 47 100 * Do any ABI specific setup for a bound event channel before it can 48 101 * be unmasked and used. 49 102 */ 50 - static inline int xen_evtchn_port_setup(struct irq_info *info) 103 + static inline int xen_evtchn_port_setup(evtchn_port_t evtchn) 51 104 { 52 105 if (evtchn_ops->setup) 53 - return evtchn_ops->setup(info); 106 + return evtchn_ops->setup(evtchn); 54 107 return 0; 55 108 } 56 109 57 - static inline void xen_evtchn_port_bind_to_cpu(struct irq_info *info, 58 - unsigned cpu) 110 + static inline void xen_evtchn_port_bind_to_cpu(evtchn_port_t evtchn, 111 + unsigned int cpu, 112 + unsigned int old_cpu) 59 113 { 60 - evtchn_ops->bind_to_cpu(info, cpu); 114 + evtchn_ops->bind_to_cpu(evtchn, cpu, old_cpu); 61 115 } 62 116 63 117 static inline void clear_evtchn(evtchn_port_t port)
-8
include/xen/events.h
··· 35 35 unsigned long irqflags, 36 36 const char *devname, 37 37 void *dev_id); 38 - int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, 39 - evtchn_port_t remote_port); 40 38 int bind_interdomain_evtchn_to_irq_lateeoi(unsigned int remote_domain, 41 39 evtchn_port_t remote_port); 42 - int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, 43 - evtchn_port_t remote_port, 44 - irq_handler_t handler, 45 - unsigned long irqflags, 46 - const char *devname, 47 - void *dev_id); 48 40 int bind_interdomain_evtchn_to_irqhandler_lateeoi(unsigned int remote_domain, 49 41 evtchn_port_t remote_port, 50 42 irq_handler_t handler,