Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/612833/?format=api
{ "id": 612833, "url": "http://patchwork.ozlabs.org/api/patches/612833/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1461167156-6737-3-git-send-email-dvlasenk@redhat.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": "<1461167156-6737-3-git-send-email-dvlasenk@redhat.com>", "list_archive_url": null, "date": "2016-04-20T15:45:56", "name": "[3/3] e1000e: e1000e_cyclecounter_read(): do overflow check only if needed", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "2b03ee62b3eaca9a33abf7c22e773d4b1cfe0ec8", "submitter": { "id": 11718, "url": "http://patchwork.ozlabs.org/api/people/11718/?format=api", "name": "Denys Vlasenko", "email": "dvlasenk@redhat.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/1461167156-6737-3-git-send-email-dvlasenk@redhat.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/612833/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/612833/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id 3qqsRT0FzHz9t3Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Apr 2016 05:30:28 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 5128330E6E;\n\tWed, 20 Apr 2016 19:30:28 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id XSU2LlEBef2f; Wed, 20 Apr 2016 19:30:26 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 106C931404;\n\tWed, 20 Apr 2016 19:30:25 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 7D71E1C174C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 15:46:19 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 78A77C0298\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 15:46:19 +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 q61XBSgwkd-r for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 15:46:14 +0000 (UTC)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 3C84AC034E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 15:46:09 +0000 (UTC)", "from int-mx13.intmail.prod.int.phx2.redhat.com\n\t(int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id B5AEB2027F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 20 Apr 2016 15:46:08 +0000 (UTC)", "from localhost.localdomain (dhcp-1-191.brq.redhat.com\n\t[10.34.1.191])\n\tby int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with\n\tESMTP id u3KFk0at001773; Wed, 20 Apr 2016 11:46:08 -0400" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "From": "Denys Vlasenko <dvlasenk@redhat.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 20 Apr 2016 17:45:56 +0200", "Message-Id": "<1461167156-6737-3-git-send-email-dvlasenk@redhat.com>", "In-Reply-To": "<1461167156-6737-1-git-send-email-dvlasenk@redhat.com>", "References": "<1461167156-6737-1-git-send-email-dvlasenk@redhat.com>", "X-Scanned-By": "MIMEDefang 2.68 on 10.5.11.26", "X-Mailman-Approved-At": "Wed, 20 Apr 2016 19:30:21 +0000", "Cc": "Denys Vlasenko <dvlasenk@redhat.com>", "Subject": "[Intel-wired-lan] [PATCH 3/3] e1000e: e1000e_cyclecounter_read():\n\tdo overflow check only if needed", "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": "SYSTIMH:SYSTIML registers are incremented by 24-bit value TIMINCA[23..0]\n\ner32(SYSTIML) are probably moderately expensive (they are pci bus reads).\nCan we avoid one of them? Yes, we can.\n\nIf the SYSTIML value we see is smaller than 0xff000000, the overflow\ninto SYSTIMH would require at least two increments.\n\nWe do two reads, er32(SYSTIML) and er32(SYSTIMH), in this order.\n\nEven if one increment happens between them, the overflow into SYSTIMH\nis impossible, and we can avoid doing another er32(SYSTIML) read\nand overflow check.\n\nSigned-off-by: Denys Vlasenko <dvlasenk@redhat.com>\nCC: intel-wired-lan@lists.osuosl.org\n---\n drivers/net/ethernet/intel/e1000e/netdev.c | 28 ++++++++++++++--------------\n 1 file changed, 14 insertions(+), 14 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c\nindex 99d0e6e..6f17f89 100644\n--- a/drivers/net/ethernet/intel/e1000e/netdev.c\n+++ b/drivers/net/ethernet/intel/e1000e/netdev.c\n@@ -4275,7 +4275,7 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)\n \tstruct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,\n \t\t\t\t\t\t cc);\n \tstruct e1000_hw *hw = &adapter->hw;\n-\tu32 systimel_1, systimel_2, systimeh;\n+\tu32 systimel, systimeh;\n \tcycle_t systim, systim_next;\n \t/* SYSTIMH latching upon SYSTIML read does not work well.\n \t * This means that if SYSTIML overflows after we read it but before\n@@ -4283,21 +4283,21 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)\n \t * will experience a huge non linear increment in the systime value\n \t * to fix that we test for overflow and if true, we re-read systime.\n \t */\n-\tsystimel_1 = er32(SYSTIML);\n+\tsystimel = er32(SYSTIML);\n \tsystimeh = er32(SYSTIMH);\n-\tsystimel_2 = er32(SYSTIML);\n-\t/* Check for overflow. If there was no overflow, use the values */\n-\tif (systimel_1 <= systimel_2) {\n-\t\tsystim = (cycle_t)systimel_1;\n-\t\tsystim |= (cycle_t)systimeh << 32;\n-\t} else {\n-\t\t/* There was an overflow, read again SYSTIMH, and use\n-\t\t * systimel_2\n-\t\t */\n-\t\tsystimeh = er32(SYSTIMH);\n-\t\tsystim = (cycle_t)systimel_2;\n-\t\tsystim |= (cycle_t)systimeh << 32;\n+\t/* Is systimel is so large that overflow is possible? */\n+\tif (systimel >= (u32)0xffffffff - E1000_TIMINCA_INCVALUE_MASK) {\n+\t\tu32 systimel_2 = er32(SYSTIML);\n+\t\tif (systimel > systimel_2) {\n+\t\t\t/* There was an overflow, read again SYSTIMH, and use\n+\t\t\t * systimel_2\n+\t\t\t */\n+\t\t\tsystimeh = er32(SYSTIMH);\n+\t\t\tsystimel = systimel_2;\n+\t\t}\n \t}\n+\tsystim = (cycle_t)systimel;\n+\tsystim |= (cycle_t)systimeh << 32;\n \n \tif ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {\n \t\tu64 time_delta, rem, temp;\n", "prefixes": [ "3/3" ] }