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 '9p-for-5.8' of git://github.com/martinetd/linux

Pull 9p update from Dominique Martinet:
"Another very quiet cycle... Only one commit: increase the size of the
ring used for xen transport"

* tag '9p-for-5.8' of git://github.com/martinetd/linux:
9p/xen: increase XEN_9PFS_RING_ORDER

+34 -27
+34 -27
net/9p/trans_xen.c
··· 43 43 #include <net/9p/transport.h> 44 44 45 45 #define XEN_9PFS_NUM_RINGS 2 46 - #define XEN_9PFS_RING_ORDER 6 47 - #define XEN_9PFS_RING_SIZE XEN_FLEX_RING_SIZE(XEN_9PFS_RING_ORDER) 46 + #define XEN_9PFS_RING_ORDER 9 47 + #define XEN_9PFS_RING_SIZE(ring) XEN_FLEX_RING_SIZE(ring->intf->ring_order) 48 48 49 49 struct xen_9pfs_header { 50 50 uint32_t size; ··· 132 132 prod = ring->intf->out_prod; 133 133 virt_mb(); 134 134 135 - return XEN_9PFS_RING_SIZE - 136 - xen_9pfs_queued(prod, cons, XEN_9PFS_RING_SIZE) >= size; 135 + return XEN_9PFS_RING_SIZE(ring) - 136 + xen_9pfs_queued(prod, cons, XEN_9PFS_RING_SIZE(ring)) >= size; 137 137 } 138 138 139 139 static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) ··· 167 167 prod = ring->intf->out_prod; 168 168 virt_mb(); 169 169 170 - if (XEN_9PFS_RING_SIZE - xen_9pfs_queued(prod, cons, 171 - XEN_9PFS_RING_SIZE) < size) { 170 + if (XEN_9PFS_RING_SIZE(ring) - 171 + xen_9pfs_queued(prod, cons, XEN_9PFS_RING_SIZE(ring)) < size) { 172 172 spin_unlock_irqrestore(&ring->lock, flags); 173 173 goto again; 174 174 } 175 175 176 - masked_prod = xen_9pfs_mask(prod, XEN_9PFS_RING_SIZE); 177 - masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); 176 + masked_prod = xen_9pfs_mask(prod, XEN_9PFS_RING_SIZE(ring)); 177 + masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE(ring)); 178 178 179 179 xen_9pfs_write_packet(ring->data.out, p9_req->tc.sdata, size, 180 - &masked_prod, masked_cons, XEN_9PFS_RING_SIZE); 180 + &masked_prod, masked_cons, 181 + XEN_9PFS_RING_SIZE(ring)); 181 182 182 183 p9_req->status = REQ_STATUS_SENT; 183 184 virt_wmb(); /* write ring before updating pointer */ ··· 208 207 prod = ring->intf->in_prod; 209 208 virt_rmb(); 210 209 211 - if (xen_9pfs_queued(prod, cons, XEN_9PFS_RING_SIZE) < 210 + if (xen_9pfs_queued(prod, cons, XEN_9PFS_RING_SIZE(ring)) < 212 211 sizeof(h)) { 213 212 notify_remote_via_irq(ring->irq); 214 213 return; 215 214 } 216 215 217 - masked_prod = xen_9pfs_mask(prod, XEN_9PFS_RING_SIZE); 218 - masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); 216 + masked_prod = xen_9pfs_mask(prod, XEN_9PFS_RING_SIZE(ring)); 217 + masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE(ring)); 219 218 220 219 /* First, read just the header */ 221 220 xen_9pfs_read_packet(&h, ring->data.in, sizeof(h), 222 221 masked_prod, &masked_cons, 223 - XEN_9PFS_RING_SIZE); 222 + XEN_9PFS_RING_SIZE(ring)); 224 223 225 224 req = p9_tag_lookup(priv->client, h.tag); 226 225 if (!req || req->status != REQ_STATUS_SENT) { ··· 234 233 memcpy(&req->rc, &h, sizeof(h)); 235 234 req->rc.offset = 0; 236 235 237 - masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE); 236 + masked_cons = xen_9pfs_mask(cons, XEN_9PFS_RING_SIZE(ring)); 238 237 /* Then, read the whole packet (including the header) */ 239 238 xen_9pfs_read_packet(req->rc.sdata, ring->data.in, h.size, 240 239 masked_prod, &masked_cons, 241 - XEN_9PFS_RING_SIZE); 240 + XEN_9PFS_RING_SIZE(ring)); 242 241 243 242 virt_mb(); 244 243 cons += h.size; ··· 268 267 269 268 static struct p9_trans_module p9_xen_trans = { 270 269 .name = "xen", 271 - .maxsize = 1 << (XEN_9PFS_RING_ORDER + XEN_PAGE_SHIFT), 270 + .maxsize = 1 << (XEN_9PFS_RING_ORDER + XEN_PAGE_SHIFT - 2), 272 271 .def = 1, 273 272 .create = p9_xen_create, 274 273 .close = p9_xen_close, ··· 296 295 if (priv->rings[i].irq > 0) 297 296 unbind_from_irqhandler(priv->rings[i].irq, priv->dev); 298 297 if (priv->rings[i].data.in) { 299 - for (j = 0; j < (1 << XEN_9PFS_RING_ORDER); j++) { 298 + for (j = 0; 299 + j < (1 << priv->rings[i].intf->ring_order); 300 + j++) { 300 301 grant_ref_t ref; 301 302 302 303 ref = priv->rings[i].intf->ref[j]; 303 304 gnttab_end_foreign_access(ref, 0, 0); 304 305 } 305 306 free_pages((unsigned long)priv->rings[i].data.in, 306 - XEN_9PFS_RING_ORDER - 307 + priv->rings[i].intf->ring_order - 307 308 (PAGE_SHIFT - XEN_PAGE_SHIFT)); 308 309 } 309 310 gnttab_end_foreign_access(priv->rings[i].ref, 0, 0); ··· 326 323 } 327 324 328 325 static int xen_9pfs_front_alloc_dataring(struct xenbus_device *dev, 329 - struct xen_9pfs_dataring *ring) 326 + struct xen_9pfs_dataring *ring, 327 + unsigned int order) 330 328 { 331 329 int i = 0; 332 330 int ret = -ENOMEM; ··· 346 342 goto out; 347 343 ring->ref = ret; 348 344 bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 349 - XEN_9PFS_RING_ORDER - (PAGE_SHIFT - XEN_PAGE_SHIFT)); 345 + order - (PAGE_SHIFT - XEN_PAGE_SHIFT)); 350 346 if (!bytes) { 351 347 ret = -ENOMEM; 352 348 goto out; 353 349 } 354 - for (; i < (1 << XEN_9PFS_RING_ORDER); i++) { 350 + for (; i < (1 << order); i++) { 355 351 ret = gnttab_grant_foreign_access( 356 352 dev->otherend_id, virt_to_gfn(bytes) + i, 0); 357 353 if (ret < 0) 358 354 goto out; 359 355 ring->intf->ref[i] = ret; 360 356 } 361 - ring->intf->ring_order = XEN_9PFS_RING_ORDER; 357 + ring->intf->ring_order = order; 362 358 ring->data.in = bytes; 363 - ring->data.out = bytes + XEN_9PFS_RING_SIZE; 359 + ring->data.out = bytes + XEN_FLEX_RING_SIZE(order); 364 360 365 361 ret = xenbus_alloc_evtchn(dev, &ring->evtchn); 366 362 if (ret) ··· 378 374 for (i--; i >= 0; i--) 379 375 gnttab_end_foreign_access(ring->intf->ref[i], 0, 0); 380 376 free_pages((unsigned long)bytes, 381 - XEN_9PFS_RING_ORDER - 377 + ring->intf->ring_order - 382 378 (PAGE_SHIFT - XEN_PAGE_SHIFT)); 383 379 } 384 380 gnttab_end_foreign_access(ring->ref, 0, 0); ··· 408 404 return -EINVAL; 409 405 max_ring_order = xenbus_read_unsigned(dev->otherend, 410 406 "max-ring-page-order", 0); 411 - if (max_ring_order < XEN_9PFS_RING_ORDER) 412 - return -EINVAL; 407 + if (max_ring_order > XEN_9PFS_RING_ORDER) 408 + max_ring_order = XEN_9PFS_RING_ORDER; 409 + if (p9_xen_trans.maxsize > XEN_FLEX_RING_SIZE(max_ring_order)) 410 + p9_xen_trans.maxsize = XEN_FLEX_RING_SIZE(max_ring_order) / 2; 413 411 414 412 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 415 413 if (!priv) ··· 428 422 429 423 for (i = 0; i < priv->num_rings; i++) { 430 424 priv->rings[i].priv = priv; 431 - ret = xen_9pfs_front_alloc_dataring(dev, &priv->rings[i]); 425 + ret = xen_9pfs_front_alloc_dataring(dev, &priv->rings[i], 426 + max_ring_order); 432 427 if (ret < 0) 433 428 goto error; 434 429 }