get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1305980/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1305980,
    "url": "http://patchwork.ozlabs.org/api/patches/1305980/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200609131945.18373-1-ciara.loftus@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20200609131945.18373-1-ciara.loftus@intel.com>",
    "list_archive_url": null,
    "date": "2020-06-09T13:19:43",
    "name": "[net,1/3] ixgbe: protect ring accesses with READ- and WRITE_ONCE",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "030bec7778bfc18236390356c82f20bbdbd07b4e",
    "submitter": {
        "id": 67255,
        "url": "http://patchwork.ozlabs.org/api/people/67255/?format=api",
        "name": "Ciara Loftus",
        "email": "ciara.loftus@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200609131945.18373-1-ciara.loftus@intel.com/mbox/",
    "series": [
        {
            "id": 182261,
            "url": "http://patchwork.ozlabs.org/api/series/182261/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=182261",
            "date": "2020-06-09T13:19:43",
            "name": "[net,1/3] ixgbe: protect ring accesses with READ- and WRITE_ONCE",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/182261/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1305980/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1305980/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49hB8W62klz9sRK\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  9 Jun 2020 23:40:43 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 7302488790;\n\tTue,  9 Jun 2020 13:40:41 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id CBbqJzvaqnPg; Tue,  9 Jun 2020 13:40:39 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id D5F8D8878B;\n\tTue,  9 Jun 2020 13:40:39 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by ash.osuosl.org (Postfix) with ESMTP id 06CC61BF5AA\n for <intel-wired-lan@lists.osuosl.org>; Tue,  9 Jun 2020 13:40:39 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by fraxinus.osuosl.org (Postfix) with ESMTP id 01DE485A57\n for <intel-wired-lan@lists.osuosl.org>; Tue,  9 Jun 2020 13:40:39 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id z96QmYI6MesZ for <intel-wired-lan@lists.osuosl.org>;\n Tue,  9 Jun 2020 13:40:38 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by fraxinus.osuosl.org (Postfix) with ESMTPS id 15C5485108\n for <intel-wired-lan@lists.osuosl.org>; Tue,  9 Jun 2020 13:40:38 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Jun 2020 06:40:37 -0700",
            "from silpixa00399839.ir.intel.com (HELO localhost.localdomain)\n ([10.237.222.8])\n by fmsmga004.fm.intel.com with ESMTP; 09 Jun 2020 06:40:35 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "\n 3UjOJOSFgnfnd9rE6sOOdb7qXBM+mDCwvo122B+J4osNyKr2sUOP66DWdJOd58qUWqhns9kZ7G\n THh9Nl1PPlqA==",
            "\n W8IY8ewGYUQfdlLDPA4gDV6c29NM1Bs+tnTCOdwi+FpyEFhBO0lRDWElP7UmVp2IlqROkJFhny\n AfqZPRbo6Kgw=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.73,492,1583222400\"; d=\"scan'208\";a=\"295837398\"",
        "From": "Ciara Loftus <ciara.loftus@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue,  9 Jun 2020 13:19:43 +0000",
        "Message-Id": "<20200609131945.18373-1-ciara.loftus@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH net 1/3] ixgbe: protect ring accesses with\n READ- and WRITE_ONCE",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "netdev@vger.kernel.org, bjorn.topel@intel.com, magnus.karlsson@intel.com",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "READ_ONCE should be used when reading rings prior to accessing the\nstatistics pointer. Introduce this as well as the corresponding WRITE_ONCE\nusage when allocating and freeing the rings, to ensure protected access.\n\nSigned-off-by: Ciara Loftus <ciara.loftus@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c  | 12 ++++++------\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +++++++++++---\n 2 files changed, 17 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c\nindex fd9f5d41b594..2e35c5706cf1 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c\n@@ -921,7 +921,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,\n \t\tring->queue_index = txr_idx;\n \n \t\t/* assign ring to adapter */\n-\t\tadapter->tx_ring[txr_idx] = ring;\n+\t\tWRITE_ONCE(adapter->tx_ring[txr_idx], ring);\n \n \t\t/* update count and index */\n \t\ttxr_count--;\n@@ -948,7 +948,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,\n \t\tset_ring_xdp(ring);\n \n \t\t/* assign ring to adapter */\n-\t\tadapter->xdp_ring[xdp_idx] = ring;\n+\t\tWRITE_ONCE(adapter->xdp_ring[xdp_idx], ring);\n \n \t\t/* update count and index */\n \t\txdp_count--;\n@@ -991,7 +991,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,\n \t\tring->queue_index = rxr_idx;\n \n \t\t/* assign ring to adapter */\n-\t\tadapter->rx_ring[rxr_idx] = ring;\n+\t\tWRITE_ONCE(adapter->rx_ring[rxr_idx], ring);\n \n \t\t/* update count and index */\n \t\trxr_count--;\n@@ -1020,13 +1020,13 @@ static void ixgbe_free_q_vector(struct ixgbe_adapter *adapter, int v_idx)\n \n \tixgbe_for_each_ring(ring, q_vector->tx) {\n \t\tif (ring_is_xdp(ring))\n-\t\t\tadapter->xdp_ring[ring->queue_index] = NULL;\n+\t\t\tWRITE_ONCE(adapter->xdp_ring[ring->queue_index], NULL);\n \t\telse\n-\t\t\tadapter->tx_ring[ring->queue_index] = NULL;\n+\t\t\tWRITE_ONCE(adapter->tx_ring[ring->queue_index], NULL);\n \t}\n \n \tixgbe_for_each_ring(ring, q_vector->rx)\n-\t\tadapter->rx_ring[ring->queue_index] = NULL;\n+\t\tWRITE_ONCE(adapter->rx_ring[ring->queue_index], NULL);\n \n \tadapter->q_vector[v_idx] = NULL;\n \tnapi_hash_del(&q_vector->napi);\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex f162b8b8f345..97a423ecf808 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -7051,7 +7051,10 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)\n \t}\n \n \tfor (i = 0; i < adapter->num_rx_queues; i++) {\n-\t\tstruct ixgbe_ring *rx_ring = adapter->rx_ring[i];\n+\t\tstruct ixgbe_ring *rx_ring = READ_ONCE(adapter->rx_ring[i]);\n+\n+\t\tif (!rx_ring)\n+\t\t\tcontinue;\n \t\tnon_eop_descs += rx_ring->rx_stats.non_eop_descs;\n \t\talloc_rx_page += rx_ring->rx_stats.alloc_rx_page;\n \t\talloc_rx_page_failed += rx_ring->rx_stats.alloc_rx_page_failed;\n@@ -7072,15 +7075,20 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)\n \tpackets = 0;\n \t/* gather some stats to the adapter struct that are per queue */\n \tfor (i = 0; i < adapter->num_tx_queues; i++) {\n-\t\tstruct ixgbe_ring *tx_ring = adapter->tx_ring[i];\n+\t\tstruct ixgbe_ring *tx_ring = READ_ONCE(adapter->tx_ring[i]);\n+\n+\t\tif (!tx_ring)\n+\t\t\tcontinue;\n \t\trestart_queue += tx_ring->tx_stats.restart_queue;\n \t\ttx_busy += tx_ring->tx_stats.tx_busy;\n \t\tbytes += tx_ring->stats.bytes;\n \t\tpackets += tx_ring->stats.packets;\n \t}\n \tfor (i = 0; i < adapter->num_xdp_queues; i++) {\n-\t\tstruct ixgbe_ring *xdp_ring = adapter->xdp_ring[i];\n+\t\tstruct ixgbe_ring *xdp_ring = READ_ONCE(adapter->xdp_ring[i]);\n \n+\t\tif (!xdp_ring)\n+\t\t\tcontinue;\n \t\trestart_queue += xdp_ring->tx_stats.restart_queue;\n \t\ttx_busy += xdp_ring->tx_stats.tx_busy;\n \t\tbytes += xdp_ring->stats.bytes;\n",
    "prefixes": [
        "net",
        "1/3"
    ]
}