get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 546250,
    "url": "http://patchwork.ozlabs.org/api/patches/546250/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1447890426-15471-1-git-send-email-jesse.brandeburg@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": "<1447890426-15471-1-git-send-email-jesse.brandeburg@intel.com>",
    "list_archive_url": null,
    "date": "2015-11-18T23:47:06",
    "name": "[net,v2] i40e/i40evf: avoid mutex re-init",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b0d066f1e1a231418a3cb1c28048d78911e7499a",
    "submitter": {
        "id": 189,
        "url": "http://patchwork.ozlabs.org/api/people/189/?format=api",
        "name": "Jesse Brandeburg",
        "email": "jesse.brandeburg@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/1447890426-15471-1-git-send-email-jesse.brandeburg@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/546250/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/546250/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.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"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ozlabs.org (Postfix) with ESMTP id 3FD161401F6\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 19 Nov 2015 10:49:00 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 8A68189F9F;\n\tWed, 18 Nov 2015 23:48:59 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id F-uMSNG6aGtK; Wed, 18 Nov 2015 23:48:58 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id C97858591A;\n\tWed, 18 Nov 2015 23:48:58 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 022831C16C0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 18 Nov 2015 23:48:57 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id F1A009451B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 18 Nov 2015 23:48:56 +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 vwnoha72XIhd for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 18 Nov 2015 23:48:55 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id E6F3F94B2D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 18 Nov 2015 23:48:55 +0000 (UTC)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga103.jf.intel.com with ESMTP; 18 Nov 2015 15:48:55 -0800",
            "from jbrandeb-hsm2.jf.intel.com ([134.134.3.178])\n\tby fmsmga001.fm.intel.com with ESMTP; 18 Nov 2015 15:48:55 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.20,315,1444719600\"; d=\"scan'208\";a=\"841906152\"",
        "From": "Jesse Brandeburg <jesse.brandeburg@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 18 Nov 2015 15:47:06 -0800",
        "Message-Id": "<1447890426-15471-1-git-send-email-jesse.brandeburg@intel.com>",
        "X-Mailer": "git-send-email 2.1.0",
        "Subject": "[Intel-wired-lan] [net PATCH v2] i40e/i40evf: avoid mutex re-init",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "If the driver were to happen to have a mutex held while\nthe i40e_init_adminq call was called, the init_adminq might\ninadvertently call mutex_init on a lock that was held\nwhich is a violation of the calling semantics.\n\nFix this by avoiding adminq.c code allocating/freeing this memory, and\nthen do the same work only once in probe/remove.\n\nTesting Hints (Required if no HSD): for VF, load i40evf in bare metal\nand echo 32 > sriov_numvfs; echo 0 > sriov_numvfs in a loop.  Yes this\nis a horrible thing to do.\n\nReported-by: Stefan Assmann <sassmann@redhat.com>\nSigned-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>\nChange-ID: Ida263c51b34e195252179e7e5e400d73a99be7a2\n\n---\n\nv2: removed old calls to mutex_init that are no longer necessary\n---\n drivers/net/ethernet/intel/i40e/i40e_adminq.c   |  6 ------\n drivers/net/ethernet/intel/i40e/i40e_main.c     | 11 ++++++++++-\n drivers/net/ethernet/intel/i40evf/i40e_adminq.c |  6 ------\n drivers/net/ethernet/intel/i40evf/i40evf_main.c | 10 ++++++++++\n 4 files changed, 20 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c\nindex 0ff8f01..1fd5ea8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c\n@@ -567,10 +567,6 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw)\n \t\tgoto init_adminq_exit;\n \t}\n \n-\t/* initialize locks */\n-\tmutex_init(&hw->aq.asq_mutex);\n-\tmutex_init(&hw->aq.arq_mutex);\n-\n \t/* Set up register offsets */\n \ti40e_adminq_init_regs(hw);\n \n@@ -664,8 +660,6 @@ i40e_status i40e_shutdown_adminq(struct i40e_hw *hw)\n \ti40e_shutdown_asq(hw);\n \ti40e_shutdown_arq(hw);\n \n-\t/* destroy the locks */\n-\n \tif (hw->nvm_buff.va)\n \t\ti40e_free_virt_mem(hw, &hw->nvm_buff);\n \ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 36645828..181dc81 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -10457,6 +10457,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t/* set up a default setting for link flow control */\n \tpf->hw.fc.requested_mode = I40E_FC_NONE;\n \n+\t/* set up the locks for the AQ, do this only once in probe\n+\t * and destroy them only once in remove\n+\t */\n+\tmutex_init(&hw->aq.asq_mutex);\n+\tmutex_init(&hw->aq.arq_mutex);\n+\n \terr = i40e_init_adminq(hw);\n \tif (err) {\n \t\tif (err == I40E_ERR_FIRMWARE_API_VERSION)\n@@ -10874,7 +10880,6 @@ static void i40e_remove(struct pci_dev *pdev)\n \tset_bit(__I40E_DOWN, &pf->state);\n \tdel_timer_sync(&pf->service_timer);\n \tcancel_work_sync(&pf->service_task);\n-\ti40e_fdir_teardown(pf);\n \n \tif (pf->flags & I40E_FLAG_SRIOV_ENABLED) {\n \t\ti40e_free_vfs(pf);\n@@ -10917,6 +10922,10 @@ static void i40e_remove(struct pci_dev *pdev)\n \t\t\t \"Failed to destroy the Admin Queue resources: %d\\n\",\n \t\t\t ret_code);\n \n+\t/* destroy the locks only once, here */\n+\tmutex_destroy(&hw->aq.arq_mutex);\n+\tmutex_destroy(&hw->aq.asq_mutex);\n+\n \t/* Clear all dynamic memory lists of rings, q_vectors, and VSIs */\n \ti40e_clear_interrupt_scheme(pf);\n \tfor (i = 0; i < pf->num_alloc_vsi; i++) {\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c\nindex fd123ca..3f65e39 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c\n@@ -551,10 +551,6 @@ i40e_status i40evf_init_adminq(struct i40e_hw *hw)\n \t\tgoto init_adminq_exit;\n \t}\n \n-\t/* initialize locks */\n-\tmutex_init(&hw->aq.asq_mutex);\n-\tmutex_init(&hw->aq.arq_mutex);\n-\n \t/* Set up register offsets */\n \ti40e_adminq_init_regs(hw);\n \n@@ -596,8 +592,6 @@ i40e_status i40evf_shutdown_adminq(struct i40e_hw *hw)\n \ti40e_shutdown_asq(hw);\n \ti40e_shutdown_arq(hw);\n \n-\t/* destroy the locks */\n-\n \tif (hw->nvm_buff.va)\n \t\ti40e_free_virt_mem(hw, &hw->nvm_buff);\n \ndiff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex 7e207ed..6da6cd7 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -2652,6 +2652,12 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \thw->bus.device = PCI_SLOT(pdev->devfn);\n \thw->bus.func = PCI_FUNC(pdev->devfn);\n \n+\t/* set up the locks for the AQ, do this only once in probe\n+\t * and destroy them only once in remove\n+\t */\n+\tmutex_init(&hw->aq.asq_mutex);\n+\tmutex_init(&hw->aq.arq_mutex);\n+\n \tINIT_LIST_HEAD(&adapter->mac_filter_list);\n \tINIT_LIST_HEAD(&adapter->vlan_filter_list);\n \n@@ -2808,6 +2814,10 @@ static void i40evf_remove(struct pci_dev *pdev)\n \tif (hw->aq.asq.count)\n \t\ti40evf_shutdown_adminq(hw);\n \n+\t/* destroy the locks only once, here */\n+\tmutex_destroy(&hw->aq.arq_mutex);\n+\tmutex_destroy(&hw->aq.asq_mutex);\n+\n \tiounmap(hw->hw_addr);\n \tpci_release_regions(pdev);\n \n",
    "prefixes": [
        "net",
        "v2"
    ]
}