Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1301018/?format=api
{ "id": 1301018, "url": "http://patchwork.ozlabs.org/api/patches/1301018/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200529211039.1673605-1-jeffrey.t.kirsher@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": "<20200529211039.1673605-1-jeffrey.t.kirsher@intel.com>", "list_archive_url": null, "date": "2020-05-29T21:10:39", "name": "[next-queue,v2] i40e: Remove scheduling while atomic possibility", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "4984270a68ba508fc67811366ccce9118ca59a03", "submitter": { "id": 473, "url": "http://patchwork.ozlabs.org/api/people/473/?format=api", "name": "Kirsher, Jeffrey T", "email": "jeffrey.t.kirsher@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/20200529211039.1673605-1-jeffrey.t.kirsher@intel.com/mbox/", "series": [ { "id": 180282, "url": "http://patchwork.ozlabs.org/api/series/180282/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=180282", "date": "2020-05-29T21:10:39", "name": "[next-queue,v2] i40e: Remove scheduling while atomic possibility", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/180282/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1301018/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1301018/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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 49Ycg003bcz9sRN\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 30 May 2020 07:10:51 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id EEA2A88559;\n\tFri, 29 May 2020 21:10:49 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id H6YgvS+wL7tA; Fri, 29 May 2020 21:10:48 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 4BA7088543;\n\tFri, 29 May 2020 21:10:48 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n by ash.osuosl.org (Postfix) with ESMTP id 476BA1BF863\n for <intel-wired-lan@lists.osuosl.org>; Fri, 29 May 2020 21:10:46 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by silver.osuosl.org (Postfix) with ESMTP id 7AA891FFFE\n for <intel-wired-lan@lists.osuosl.org>; Fri, 29 May 2020 21:10:44 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id wqX0l+GS-cdj for <intel-wired-lan@lists.osuosl.org>;\n Fri, 29 May 2020 21:10:42 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by silver.osuosl.org (Postfix) with ESMTPS id 50CA422621\n for <intel-wired-lan@lists.osuosl.org>; Fri, 29 May 2020 21:10:42 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 29 May 2020 14:10:41 -0700", "from jtkirshe-desk1.jf.intel.com ([134.134.177.86])\n by FMSMGA003.fm.intel.com with ESMTP; 29 May 2020 14:10:41 -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 X/qcMLKoVJ4TVdcHHLZ4xMjIl8ZUjCJXuNMtd8X1rw0ZxmyaW+QuekfxmcgvUnseD2EN2NiIU/\n 1LX82Y4qbY8Q==", "\n FQatgYaPQBZ7jUOfQ1e9wLojtPOa97ubmfhwdbaC7QgR2qrUUnyqX9YP5nqjyTyqsEVwP9gbyO\n GGxFXBUFIXHQ==" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.73,450,1583222400\"; d=\"scan'208\";a=\"311371037\"", "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 29 May 2020 14:10:39 -0700", "Message-Id": "<20200529211039.1673605-1-jeffrey.t.kirsher@intel.com>", "X-Mailer": "git-send-email 2.26.2", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [next-queue v2] i40e: Remove scheduling while\n atomic possibility", "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": "Aleksandr Loktionov <aleksandr.loktionov@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": "From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n\nIn some occasions task held spinlock, while being rescheduled due to\nmutex_lock. Moved function call outside of atomic context. Without\nthis patch there is a race condition, which might result in scheduling\nwhile atomic.\n\nSigned-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n---\nv2: fixed trailing whitespace\n\n .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 222 +++++++++++-------\n 1 file changed, 135 insertions(+), 87 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 56b9e445732b..539fdb5f4c50 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -1107,6 +1107,11 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf)\n }\n \n static inline int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi);\n+static inline void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,\n+\t\t\t\t\t s16 **vlan_list);\n+static inline i40e_status\n+i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,\n+\t\t bool unicast_enable, s16 *vl, int num_vlans);\n \n /**\n * i40e_config_vf_promiscuous_mode\n@@ -1123,108 +1128,35 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf,\n \t\t\t\t\t\t bool allmulti,\n \t\t\t\t\t\t bool alluni)\n {\n+\ti40e_status aq_ret = I40E_SUCCESS;\n \tstruct i40e_pf *pf = vf->pf;\n-\tstruct i40e_hw *hw = &pf->hw;\n-\tstruct i40e_mac_filter *f;\n-\ti40e_status aq_ret = 0;\n \tstruct i40e_vsi *vsi;\n-\tint bkt;\n+\tint num_vlans;\n+\ts16 *vl;\n \n \tvsi = i40e_find_vsi_from_id(pf, vsi_id);\n \tif (!i40e_vc_isvalid_vsi_id(vf, vsi_id) || !vsi)\n \t\treturn I40E_ERR_PARAM;\n \n \tif (vf->port_vlan_id) {\n-\t\taq_ret = i40e_aq_set_vsi_mc_promisc_on_vlan(hw, vsi->seid,\n-\t\t\t\t\t\t\t allmulti,\n-\t\t\t\t\t\t\t vf->port_vlan_id,\n-\t\t\t\t\t\t\t NULL);\n-\t\tif (aq_ret) {\n-\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n-\n-\t\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\t\"VF %d failed to set multicast promiscuous mode err %s aq_err %s\\n\",\n-\t\t\t\tvf->vf_id,\n-\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n-\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n-\t\t\treturn aq_ret;\n-\t\t}\n-\n-\t\taq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, vsi->seid,\n-\t\t\t\t\t\t\t alluni,\n-\t\t\t\t\t\t\t vf->port_vlan_id,\n-\t\t\t\t\t\t\t NULL);\n-\t\tif (aq_ret) {\n-\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n-\n-\t\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\t\"VF %d failed to set unicast promiscuous mode err %s aq_err %s\\n\",\n-\t\t\t\tvf->vf_id,\n-\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n-\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n-\t\t}\n+\t\taq_ret = i40e_set_vsi_promisc(vf, vsi->seid, allmulti,\n+\t\t\t\t\t alluni, &vf->port_vlan_id, 1);\n \t\treturn aq_ret;\n \t} else if (i40e_getnum_vf_vsi_vlan_filters(vsi)) {\n-\t\thash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {\n-\t\t\tif (f->vlan < 0 || f->vlan > I40E_MAX_VLANID)\n-\t\t\t\tcontinue;\n-\t\t\taq_ret = i40e_aq_set_vsi_mc_promisc_on_vlan(hw,\n-\t\t\t\t\t\t\t\t vsi->seid,\n-\t\t\t\t\t\t\t\t allmulti,\n-\t\t\t\t\t\t\t\t f->vlan,\n-\t\t\t\t\t\t\t\t NULL);\n-\t\t\tif (aq_ret) {\n-\t\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n+\t\ti40e_get_vlan_list_sync(vsi, &num_vlans, &vl);\n \n-\t\t\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\t\t\"Could not add VLAN %d to multicast promiscuous domain err %s aq_err %s\\n\",\n-\t\t\t\t\tf->vlan,\n-\t\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n-\t\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n-\t\t\t}\n+\t\tif (!vl)\n+\t\t\treturn I40E_ERR_NO_MEMORY;\n \n-\t\t\taq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw,\n-\t\t\t\t\t\t\t\t vsi->seid,\n-\t\t\t\t\t\t\t\t alluni,\n-\t\t\t\t\t\t\t\t f->vlan,\n-\t\t\t\t\t\t\t\t NULL);\n-\t\t\tif (aq_ret) {\n-\t\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n-\n-\t\t\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\t\t\"Could not add VLAN %d to Unicast promiscuous domain err %s aq_err %s\\n\",\n-\t\t\t\t\tf->vlan,\n-\t\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n-\t\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n-\t\t\t}\n-\t\t}\n-\t\treturn aq_ret;\n-\t}\n-\taq_ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid, allmulti,\n-\t\t\t\t\t\t NULL);\n-\tif (aq_ret) {\n-\t\tint aq_err = pf->hw.aq.asq_last_status;\n-\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"VF %d failed to set multicast promiscuous mode err %s aq_err %s\\n\",\n-\t\t\tvf->vf_id,\n-\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n-\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\taq_ret = i40e_set_vsi_promisc(vf, vsi->seid, allmulti, alluni,\n+\t\t\t\t\t vl, num_vlans);\n+\t\tkfree(vl);\n \t\treturn aq_ret;\n \t}\n \n-\taq_ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid, alluni,\n-\t\t\t\t\t\t NULL, true);\n-\tif (aq_ret) {\n-\t\tint aq_err = pf->hw.aq.asq_last_status;\n-\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"VF %d failed to set unicast promiscuous mode err %s aq_err %s\\n\",\n-\t\t\tvf->vf_id,\n-\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n-\t\t\ti40e_aq_str(&pf->hw, aq_err));\n-\t}\n-\n+\t/* no VLANs to set on, set on VSI */\n+\taq_ret = i40e_set_vsi_promisc(vf, vsi->seid, allmulti, alluni,\n+\t\t\t\t NULL, 0);\n \treturn aq_ret;\n }\n \n@@ -1991,6 +1923,122 @@ static inline int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)\n \treturn num_vlans;\n }\n \n+/**\n+ * i40e_get_vlan_list_sync\n+ * @vsi: pointer to the VSI\n+ * @num_vlans: number of VLANs in mac_filter_hash, returned to caller\n+ * @vlan_list: list of VLANs present in mac_filter_hash, returned to caller.\n+ * This array is allocated here, but has to be freed in caller.\n+ *\n+ * Called to get number of VLANs and VLAN list present in mac_filter_hash.\n+ **/\n+static inline void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,\n+\t\t\t\t\t s16 **vlan_list)\n+{\n+\tstruct i40e_mac_filter *f;\n+\tint bkt;\n+\tint i = 0;\n+\n+\tspin_lock_bh(&vsi->mac_filter_hash_lock);\n+\t*num_vlans = i40e_getnum_vf_vsi_vlan_filters(vsi);\n+\t*vlan_list = kcalloc(*num_vlans, sizeof(**vlan_list),\n+\t\t\t GFP_ATOMIC);\n+\tif (!(*vlan_list))\n+\t\tgoto err;\n+\n+\thash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {\n+\t\tif (f->vlan < 0 || f->vlan > I40E_MAX_VLANID)\n+\t\t\tcontinue;\n+\t\t(*vlan_list)[i++] = f->vlan;\n+\t}\n+err:\n+\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n+}\n+\n+/**\n+ * i40e_set_vsi_promisc\n+ * @vf: pointer to the VF struct\n+ * @seid: VSI number\n+ * @multi_enable: set MAC L2 layer multicast promiscuous enable/disable\n+ * for a given VLAN\n+ * @unicast_enable: set MAC L2 layer unicast promiscuous enable/disable\n+ * for a given VLAN\n+ * @vl: List of VLANs - apply filter for given VLANs\n+ * @num_vlans: Number of elements in @vl\n+ **/\n+static inline i40e_status\n+i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,\n+\t\t bool unicast_enable, s16 *vl, int num_vlans)\n+{\n+\tstruct i40e_pf *pf = vf->pf;\n+\tstruct i40e_hw *hw = &pf->hw;\n+\ti40e_status aq_ret;\n+\tint i;\n+\n+\t/* No VLAN to set promisc on, set on VSI */\n+\tif (!num_vlans || !vl) {\n+\t\taq_ret = i40e_aq_set_vsi_multicast_promiscuous(hw, seid,\n+\t\t\t\t\t\t\t multi_enable,\n+\t\t\t\t\t\t\t NULL);\n+\t\tif (aq_ret) {\n+\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n+\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"VF %d failed to set multicast promiscuous mode err %s aq_err %s\\n\",\n+\t\t\t\tvf->vf_id,\n+\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\n+\t\t\treturn aq_ret;\n+\t\t}\n+\n+\t\taq_ret = i40e_aq_set_vsi_unicast_promiscuous(hw, seid,\n+\t\t\t\t\t\t\t unicast_enable,\n+\t\t\t\t\t\t\t NULL, true);\n+\n+\t\tif (aq_ret) {\n+\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n+\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"VF %d failed to set unicast promiscuous mode err %s aq_err %s\\n\",\n+\t\t\t\tvf->vf_id,\n+\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\t}\n+\n+\t\treturn aq_ret;\n+\t}\n+\n+\tfor (i = 0; i < num_vlans; i++) {\n+\t\taq_ret = i40e_aq_set_vsi_mc_promisc_on_vlan(hw, seid,\n+\t\t\t\t\t\t\t multi_enable,\n+\t\t\t\t\t\t\t vl[i], NULL);\n+\t\tif (aq_ret) {\n+\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n+\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"VF %d failed to set multicast promiscuous mode err %s aq_err %s\\n\",\n+\t\t\t\tvf->vf_id,\n+\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\t}\n+\n+\t\taq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,\n+\t\t\t\t\t\t\t unicast_enable,\n+\t\t\t\t\t\t\t vl[i], NULL);\n+\t\tif (aq_ret) {\n+\t\t\tint aq_err = pf->hw.aq.asq_last_status;\n+\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"VF %d failed to set unicast promiscuous mode err %s aq_err %s\\n\",\n+\t\t\t\tvf->vf_id,\n+\t\t\t\ti40e_stat_str(&pf->hw, aq_ret),\n+\t\t\t\ti40e_aq_str(&pf->hw, aq_err));\n+\t\t}\n+\t}\n+\treturn aq_ret;\n+}\n+\n /**\n * i40e_vc_config_promiscuous_mode_msg\n * @vf: pointer to the VF info\n", "prefixes": [ "next-queue", "v2" ] }