)]}'
{
  "commit": "a57de0b4336e48db2811a2030bb68dba8dd09d88",
  "tree": "a01c189d5fd55c69c9e2e842241e84b46728bc60",
  "parents": [
    "1b614fb9a00e97b1eab54d4e442d405229c059dd"
  ],
  "author": {
    "name": "Jiri Olsa",
    "email": "jolsa@redhat.com",
    "time": "Wed Jul 08 12:09:13 2009 +0000"
  },
  "committer": {
    "name": "David S. Miller",
    "email": "davem@davemloft.net",
    "time": "Thu Jul 09 17:06:57 2009 -0700"
  },
  "message": "net: adding memory barrier to the poll and receive callbacks\n\nAdding memory barrier after the poll_wait function, paired with\nreceive callbacks. Adding fuctions sock_poll_wait and sk_has_sleeper\nto wrap the memory barrier.\n\nWithout the memory barrier, following race can happen.\nThe race fires, when following code paths meet, and the tp-\u003ercv_nxt\nand __add_wait_queue updates stay in CPU caches.\n\nCPU1                         CPU2\n\nsys_select                   receive packet\n  ...                        ...\n  __add_wait_queue           update tp-\u003ercv_nxt\n  ...                        ...\n  tp-\u003ercv_nxt check          sock_def_readable\n  ...                        {\n  schedule                      ...\n                                if (sk-\u003esk_sleep \u0026\u0026 waitqueue_active(sk-\u003esk_sleep))\n                                        wake_up_interruptible(sk-\u003esk_sleep)\n                                ...\n                             }\n\nIf there was no cache the code would work ok, since the wait_queue and\nrcv_nxt are opposit to each other.\n\nMeaning that once tp-\u003ercv_nxt is updated by CPU2, the CPU1 either already\npassed the tp-\u003ercv_nxt check and sleeps, or will get the new value for\ntp-\u003ercv_nxt and will return with new data mask.\nIn both cases the process (CPU1) is being added to the wait queue, so the\nwaitqueue_active (CPU2) call cannot miss and will wake up CPU1.\n\nThe bad case is when the __add_wait_queue changes done by CPU1 stay in its\ncache, and so does the tp-\u003ercv_nxt update on CPU2 side.  The CPU1 will then\nendup calling schedule and sleep forever if there are no more data on the\nsocket.\n\nCalls to poll_wait in following modules were ommited:\n\tnet/bluetooth/af_bluetooth.c\n\tnet/irda/af_irda.c\n\tnet/irda/irnet/irnet_ppp.c\n\tnet/mac80211/rc80211_pid_debugfs.c\n\tnet/phonet/socket.c\n\tnet/rds/af_rds.c\n\tnet/rfkill/core.c\n\tnet/sunrpc/cache.c\n\tnet/sunrpc/rpc_pipe.c\n\tnet/tipc/socket.c\n\nSigned-off-by: Jiri Olsa \u003cjolsa@redhat.com\u003e\nSigned-off-by: Eric Dumazet \u003ceric.dumazet@gmail.com\u003e\nSigned-off-by: David S. Miller \u003cdavem@davemloft.net\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "352f06bbd7a9b14b0257b8014d4ecf3027aad44e",
      "old_mode": 33188,
      "old_path": "include/net/sock.h",
      "new_id": "4eb8409249f6dfbdec81708921fe48d24cea639d",
      "new_mode": 33188,
      "new_path": "include/net/sock.h"
    },
    {
      "type": "modify",
      "old_id": "c1c97936192c730d8f68431a782f8695c43504a3",
      "old_mode": 33188,
      "old_path": "net/atm/common.c",
      "new_id": "8c4d843eb17f46bbec50847aa1352580adcd1c26",
      "new_mode": 33188,
      "new_path": "net/atm/common.c"
    },
    {
      "type": "modify",
      "old_id": "58abee1f1df1b044514079f9245dc7c1b96978a3",
      "old_mode": 33188,
      "old_path": "net/core/datagram.c",
      "new_id": "b0fe69211eefef1e18224fa123d2b13498bffefa",
      "new_mode": 33188,
      "new_path": "net/core/datagram.c"
    },
    {
      "type": "modify",
      "old_id": "b0ba569bc97361dec5b2619a46ffbeab50331dc2",
      "old_mode": 33188,
      "old_path": "net/core/sock.c",
      "new_id": "6354863b1c687c1917388d26c439fc8eab737bf4",
      "new_mode": 33188,
      "new_path": "net/core/sock.c"
    },
    {
      "type": "modify",
      "old_id": "c0e88c16d0888b5222ca250c01a27bf3078a7e2a",
      "old_mode": 33188,
      "old_path": "net/dccp/output.c",
      "new_id": "c96119fda6885fd6b6bdc5487ff5cca7d2dd1574",
      "new_mode": 33188,
      "new_path": "net/dccp/output.c"
    },
    {
      "type": "modify",
      "old_id": "314a1b5c033c88950ddf73eccf30a34bcaf60191",
      "old_mode": 33188,
      "old_path": "net/dccp/proto.c",
      "new_id": "94ca8eaace7d05988059838bd5477831d643b65f",
      "new_mode": 33188,
      "new_path": "net/dccp/proto.c"
    },
    {
      "type": "modify",
      "old_id": "7870a535dac6484ec7886dcf8e8270b729d3eaaa",
      "old_mode": 33188,
      "old_path": "net/ipv4/tcp.c",
      "new_id": "91145244ea630777e7e4a2e7f112f3c31bc7f90e",
      "new_mode": 33188,
      "new_path": "net/ipv4/tcp.c"
    },
    {
      "type": "modify",
      "old_id": "6be5f92d10943d383ce252242233e61770b2e528",
      "old_mode": 33188,
      "old_path": "net/iucv/af_iucv.c",
      "new_id": "49c15b48408e5617a5405ba396f1f9b9e427dd5d",
      "new_mode": 33188,
      "new_path": "net/iucv/af_iucv.c"
    },
    {
      "type": "modify",
      "old_id": "eac5e7bb73659c3b951bd7fc9f564e7d380e4d9b",
      "old_mode": 33188,
      "old_path": "net/rxrpc/af_rxrpc.c",
      "new_id": "bfe493ebf27c36a7a82974af5a596ee8f75528c9",
      "new_mode": 33188,
      "new_path": "net/rxrpc/af_rxrpc.c"
    },
    {
      "type": "modify",
      "old_id": "36d4e44d62334275ffbfaa8e3b837e95bcdace5f",
      "old_mode": 33188,
      "old_path": "net/unix/af_unix.c",
      "new_id": "fc3ebb906911b955b33b39af1a6a2e729d4695c9",
      "new_mode": 33188,
      "new_path": "net/unix/af_unix.c"
    }
  ]
}
