* [PATCH 5/8] rsxx: Adding in sync_start module paramenter.
@ 2013-05-28 21:12 Philip J. Kelleher
2013-05-29 18:23 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Philip J. Kelleher @ 2013-05-28 21:12 UTC (permalink / raw)
To: axboe; +Cc: linux-kernel
From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Adding a module parameter called 'sync_start' to wait for
the card to fully up and running before driver load is
complete.
Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
-------------------------------------------------------------------------------
diff -uprN -X linux-block-vanilla/Documentation/dontdiff linux-block-vanilla/drivers/block/rsxx/core.c linux-block/drivers/block/rsxx/core.c
--- linux-block-vanilla/drivers/block/rsxx/core.c 2013-05-02 17:26:33.574206268 -0500
+++ linux-block/drivers/block/rsxx/core.c 2013-05-02 17:32:20.341185588 -0500
@@ -41,6 +41,8 @@
#include "rsxx_cfg.h"
#define NO_LEGACY 0
+#define NO_SYNC_START 0
+#define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */
MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver");
MODULE_AUTHOR("Joshua Morris/Philip Kelleher, IBM");
@@ -51,6 +53,11 @@ static unsigned int force_legacy = NO_LE
module_param(force_legacy, uint, 0444);
MODULE_PARM_DESC(force_legacy, "Force the use of legacy type PCI interrupts");
+static unsigned int sync_start = NO_SYNC_START;
+module_param(sync_start, uint, 0444);
+MODULE_PARM_DESC(sync_start,
+ "Driver load will not complete until the card startup has completed.");
+
static DEFINE_IDA(rsxx_disk_ida);
static DEFINE_SPINLOCK(rsxx_ida_lock);
@@ -716,6 +723,7 @@ static int rsxx_pci_probe(struct pci_dev
{
struct rsxx_cardinfo *card;
int st;
+ unsigned int sync_timeout;
dev_info(&dev->dev, "PCI-Flash SSD discovered\n");
@@ -874,6 +882,33 @@ static int rsxx_pci_probe(struct pci_dev
if (st)
dev_crit(CARD_TO_DEV(card),
"Failed issuing card startup\n");
+ if (sync_start) {
+ sync_timeout = SYNC_START_TIMEOUT;
+
+ dev_info(CARD_TO_DEV(card),
+ "Waiting for card to startup\n");
+
+ do {
+ ssleep(1);
+ sync_timeout--;
+
+ rsxx_get_card_state(card, &card->state);
+ } while (sync_timeout &&
+ (card->state == CARD_STATE_STARTING));
+
+ if (card->state == CARD_STATE_STARTING) {
+ dev_warn(CARD_TO_DEV(card),
+ "Card startup timed out\n");
+ card->size8 = 0;
+ } else {
+ dev_info(CARD_TO_DEV(card),
+ "card state: %s\n",
+ rsxx_card_state_to_str(card->state));
+ st = rsxx_get_card_size8(card, &card->size8);
+ if (st)
+ card->size8 = 0;
+ }
+ }
} else if (card->state == CARD_STATE_GOOD ||
card->state == CARD_STATE_RD_ONLY_FAULT) {
st = rsxx_get_card_size8(card, &card->size8);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/8] rsxx: Adding in sync_start module paramenter.
2013-05-28 21:12 [PATCH 5/8] rsxx: Adding in sync_start module paramenter Philip J. Kelleher
@ 2013-05-29 18:23 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2013-05-29 18:23 UTC (permalink / raw)
To: Philip J. Kelleher; +Cc: axboe, linux-kernel
On Wed, May 29, 2013 at 12:12 AM, Philip J. Kelleher
<pjk1939@linux.vnet.ibm.com> wrote:
> From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
>
> Adding a module parameter called 'sync_start' to wait for
> the card to fully up and running before driver load is
> complete.
> +++ linux-block/drivers/block/rsxx/core.c 2013-05-02 17:32:20.341185588 -0500
> @@ -41,6 +41,8 @@
> #include "rsxx_cfg.h"
>
> #define NO_LEGACY 0
> +#define NO_SYNC_START 0
> +#define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */
10 minutes is indefinite time. May be you have to load timer and
create device only after successfull initialization of the device?
> @@ -874,6 +882,33 @@ static int rsxx_pci_probe(struct pci_dev
> if (st)
> dev_crit(CARD_TO_DEV(card),
> "Failed issuing card startup\n");
> + if (sync_start) {
> + sync_timeout = SYNC_START_TIMEOUT;
> +
> + dev_info(CARD_TO_DEV(card),
> + "Waiting for card to startup\n");
> +
> + do {
> + ssleep(1);
Why not timers?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 5/8] rsxx: Adding in sync_start module paramenter.
@ 2013-05-02 0:29 Philip J. Kelleher
0 siblings, 0 replies; 3+ messages in thread
From: Philip J. Kelleher @ 2013-05-02 0:29 UTC (permalink / raw)
To: axboe; +Cc: linux-kernel, klebers, brking
From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Adding a module parameter called 'sync_start' to wait for
the card to fully up and running before driver load is
complete.
Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
-------------------------------------------------------------------------------
diff -uprN -X linux-block-vanilla/Documentation/dontdiff linux-block-vanilla/drivers/block/rsxx/core.c linux-block/drivers/block/rsxx/core.c
--- linux-block-vanilla/drivers/block/rsxx/core.c 2013-05-01 18:36:44.683234070 -0500
+++ linux-block/drivers/block/rsxx/core.c 2013-05-01 18:40:57.738183991 -0500
@@ -41,6 +41,8 @@
#include "rsxx_cfg.h"
#define NO_LEGACY 0
+#define NO_SYNC_START 0
+#define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */
#define DEBUGFS_NULL NULL
MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver");
@@ -52,6 +54,11 @@ static unsigned int force_legacy = NO_LE
module_param(force_legacy, uint, 0444);
MODULE_PARM_DESC(force_legacy, "Force the use of legacy type PCI interrupts");
+static unsigned int sync_start = NO_SYNC_START;
+module_param(sync_start, uint, 0444);
+MODULE_PARM_DESC(sync_start,
+ "Driver load will not complete until the card startup has completed.");
+
static DEFINE_IDA(rsxx_disk_ida);
static DEFINE_SPINLOCK(rsxx_ida_lock);
@@ -717,6 +724,7 @@ static int rsxx_pci_probe(struct pci_dev
{
struct rsxx_cardinfo *card;
int st;
+ unsigned int sync_timeout;
dev_info(&dev->dev, "PCI-Flash SSD discovered\n");
@@ -875,6 +883,33 @@ static int rsxx_pci_probe(struct pci_dev
if (st)
dev_crit(CARD_TO_DEV(card),
"Failed issuing card startup\n");
+ if (sync_start) {
+ sync_timeout = SYNC_START_TIMEOUT;
+
+ dev_info(CARD_TO_DEV(card),
+ "Waiting for card to startup\n");
+
+ do {
+ ssleep(1);
+ sync_timeout--;
+
+ rsxx_get_card_state(card, &card->state);
+ } while (sync_timeout &&
+ (card->state == CARD_STATE_STARTING));
+
+ if (card->state == CARD_STATE_STARTING) {
+ dev_warn(CARD_TO_DEV(card),
+ "Card startup timed out\n");
+ card->size8 = 0;
+ } else {
+ dev_info(CARD_TO_DEV(card),
+ "card state: %s\n",
+ rsxx_card_state_to_str(card->state));
+ st = rsxx_get_card_size8(card, &card->size8);
+ if (st)
+ card->size8 = 0;
+ }
+ }
} else if (card->state == CARD_STATE_GOOD ||
card->state == CARD_STATE_RD_ONLY_FAULT) {
st = rsxx_get_card_size8(card, &card->size8);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-29 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-28 21:12 [PATCH 5/8] rsxx: Adding in sync_start module paramenter Philip J. Kelleher
2013-05-29 18:23 ` Andy Shevchenko
-- strict thread matches above, loose matches on Subject: below --
2013-05-02 0:29 Philip J. Kelleher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.