Print this page
8634 epoll fails to wake on certain edge-triggered conditions
8635 epoll should not emit POLLNVAL
8636 recursive epoll should emit EPOLLRDNORM
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/xen/io/xpvtap.c
          +++ new/usr/src/uts/common/xen/io/xpvtap.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2017 Joyent, Inc.
  25   26   */
  26   27  
  27   28  
  28   29  #include <sys/errno.h>
  29   30  #include <sys/types.h>
  30   31  #include <sys/conf.h>
  31   32  #include <sys/kmem.h>
  32   33  #include <sys/ddi.h>
  33   34  #include <sys/stat.h>
  34   35  #include <sys/sunddi.h>
↓ open down ↓ 614 lines elided ↑ open up ↑
 649  650          instance = getminor(dev);
 650  651          if (instance == -1) {
 651  652                  return (EBADF);
 652  653          }
 653  654          state = ddi_get_soft_state(xpvtap_statep, instance);
 654  655          if (state == NULL) {
 655  656                  return (EBADF);
 656  657          }
 657  658  
 658  659          if (((events & (POLLIN | POLLRDNORM)) == 0) && !anyyet) {
 659      -                *reventsp = 0;
 660  660                  return (EINVAL);
 661  661          }
 662  662  
 663  663          /*
 664  664           * if we pushed requests on the user ring since the last poll, wakeup
 665  665           * the user app
 666  666           */
      667 +        *reventsp = 0;
 667  668          usring = &state->bt_user_ring;
 668  669          if (usring->ur_prod_polled != usring->ur_ring.req_prod_pvt) {
 669  670  
 670  671                  /*
 671  672                   * XXX - is this faster here or xpvtap_user_request_push??
 672  673                   * prelim data says here.  Because less membars or because
 673  674                   * user thread will spin in poll requests before getting to
 674  675                   * responses?
 675  676                   */
 676  677                  RING_PUSH_REQUESTS(&usring->ur_ring);
 677  678  
 678  679                  usring->ur_prod_polled = usring->ur_ring.sring->req_prod;
 679  680                  *reventsp =  POLLIN | POLLRDNORM;
      681 +        }
 680  682  
 681      -        /* no new requests */
 682      -        } else {
 683      -                *reventsp = 0;
 684      -                if (!anyyet) {
 685      -                        *phpp = &state->bt_pollhead;
 686      -                }
      683 +        if ((*reventsp == 0 && !anyyet) || (events & POLLET)) {
      684 +                *phpp = &state->bt_pollhead;
 687  685          }
 688  686  
 689  687          return (0);
 690  688  }
 691  689  
 692  690  
 693  691  /*
 694  692   * xpvtap_drv_init()
 695  693   */
 696  694  static xpvtap_state_t *
↓ open down ↓ 942 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX