From: Brice Goglin <brice@myri.com>
To: Jeff Garzik <jeff@garzik.org>, netdev@vger.kernel.org
Subject: [PATCH 1/5] myri10ge: match number of save_state and restore
Date: Mon, 18 Dec 2006 11:50:00 +0100 [thread overview]
Message-ID: <45867258.3050304@myri.com> (raw)
In-Reply-To: <45867228.1090406@myri.com>
Since pci_save_state() pushes MSI and PCIe states on a kind of stack,
myri10ge saving the state in advance for parity recovery will push the
state again on the stack on suspend. This leads to some memory leak.
We add a couple additional calls to save_state and restore_state so
that we don't leak anymore.
For the future, we are thinking of a better way to recover from parity
error without using pci_save_state().
Signed-off-by: Brice Goglin <brice@myri.com>
---
drivers/net/myri10ge/myri10ge.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c 2006-12-17 22:12:20.000000000 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c 2006-12-17 22:13:50.000000000 +0100
@@ -2641,6 +2641,10 @@
* nic was resumed from power saving mode.
*/
myri10ge_restore_state(mgp);
+
+ /* save state again for accounting reasons */
+ myri10ge_save_state(mgp);
+
} else {
/* if we get back -1's from our slot, perhaps somebody
* powered off our card. Don't try to reset it in
@@ -2907,7 +2911,7 @@
status = register_netdev(netdev);
if (status != 0) {
dev_err(&pdev->dev, "register_netdev failed: %d\n", status);
- goto abort_with_irq;
+ goto abort_with_state;
}
dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n",
(mgp->msi_enabled ? "MSI" : "xPIC"),
@@ -2916,7 +2920,8 @@
return 0;
-abort_with_irq:
+abort_with_state:
+ myri10ge_restore_state(mgp);
free_irq(pdev->irq, mgp);
if (mgp->msi_enabled)
pci_disable_msi(pdev);
@@ -2976,6 +2981,9 @@
myri10ge_dummy_rdma(mgp, 0);
+ /* avoid a memory leak */
+ myri10ge_restore_state(mgp);
+
bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry);
dma_free_coherent(&pdev->dev, bytes,
mgp->rx_done.entry, mgp->rx_done.bus);
next prev parent reply other threads:[~2006-12-18 11:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-18 10:49 [PATCH 0/5] myri10ge: IRQ and pci state cleanups Brice Goglin
2006-12-18 10:50 ` Brice Goglin [this message]
2006-12-26 21:28 ` [PATCH 1/5] myri10ge: match number of save_state and restore Jeff Garzik
2006-12-18 10:50 ` [PATCH 2/5] myri10ge: move request_irq to myri10ge_open Brice Goglin
2006-12-18 10:51 ` [PATCH 3/5] myri10ge: make msi configurable at runtime through sysfs Brice Goglin
2006-12-18 10:52 ` [PATCH 4/5] myri10ge: no need to save MSI and PCIe state in the driver Brice Goglin
2006-12-18 10:52 ` [PATCH 5/5] myri10ge: handle failures in suspend and resume Brice Goglin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45867258.3050304@myri.com \
--to=brice@myri.com \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).