Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-10-05 Thread Arthur Marsh



Jiang Liu wrote on 03/10/15 17:41:


If I do a normal boot which includes eata being loaded, the disk
attached to the DPT2044W controller having its filesystems checked and
mounted, then attempt a kexec reboot, I get the reboot pausing after the
"synchronizing SCSI cache" messages as before.

If I un-mount the filesystems on the disk attached to the DPT2044W
controller after start-up and try a reboot I get the same problem.

If I do modprobe -r eata after un-mounting the filesystems on the disk
attached to the DPT2044W controller after a start-up kexec *works fine*.

Hi Arthur,
The above results suggest that we need to shutdown eata
controller for kexec. So could you please try to apply the attached
patch upon the previous two patches?
Thanks!
Gerry



To clarify, if the eata driver gets loaded once and stays loaded, at a 
kexec reboot attempt the "Synchronising SCSI cache" message is missing 
for the SCSI disk attached to the controller using the eata driver and 
eventually other error messages appear as seen in screen images that I 
have previously posted.


If the eata driver is loaded, unloaded via modprobe -r, then reloaded, a 
kexec reboot shows 2 "Synchronising SCSI cache" messages for the SCSI 
disk attached to the controller using the eata driver and the kexec 
reboot is successful.



Arthur.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-10-03 Thread Arthur Marsh



Jiang Liu wrote on 03/10/15 17:41:


Hi Arthur,
The above results suggest that we need to shutdown eata
controller for kexec. So could you please try to apply the attached
patch upon the previous two patches?
Thanks!
Gerry



Hi, I still get kexec shutdown errors like this with the 3rd patch applied:

http://www.users.on.net/~arthur.marsh/20151003566.jpg

I can still unmount filesystems, modprobe -r eata and modprobe eata to 
get things into a state where a kexec reboot works.


Regards,

Arthur.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-10-03 Thread Jiang Liu
On 2015/9/26 14:27, Arthur Marsh wrote:
> 
> 
> Arthur Marsh wrote on 24/09/15 15:26:
>>
>>
>> Jiang Liu wrote on 24/09/15 13:58:
>>
>>> Hi James,
>>> Thanks for review. How about the attached patch which addresses
>>> the three suggestions from you?
>>> Thanks!
>>> Gerry
>>
>> I've applied the patch, rebuilt the kernel and verified that it allows
>> unloading of the eata module and reloading it, as well as a successful
>> kexec.
>>
>> Regards,
>>
>> Arthur.
> 
> After some more thorough testing I've encountered an ongoing problem
> trying to use kexec with filesystems mounted with the eata driver.
> 
> If I boot up and have the eata driver loaded but no filesystem check or
> mounting of filesystems on the disk attached to the DPT2044W controller,
> then attempt a kexec reboot I get the reboot pausing after the
> "synchronizing scsi cache" messages and getting the errors that I have
> included as pictures in my previous reports.
> 
> If I do a normal boot which includes eata being loaded, the disk
> attached to the DPT2044W controller having its filesystems checked and
> mounted, then attempt a kexec reboot, I get the reboot pausing after the
> "synchronizing SCSI cache" messages as before.
> 
> If I un-mount the filesystems on the disk attached to the DPT2044W
> controller after start-up and try a reboot I get the same problem.
> 
> If I do modprobe -r eata after un-mounting the filesystems on the disk
> attached to the DPT2044W controller after a start-up kexec *works fine*.
Hi Arthur,
The above results suggest that we need to shutdown eata
controller for kexec. So could you please try to apply the attached
patch upon the previous two patches?
Thanks!
Gerry
>From 44a7ee9008951684a6ee1482a4445a64da61f54a Mon Sep 17 00:00:00 2001
From: Jiang Liu 
Date: Sat, 3 Oct 2015 15:57:39 +0800
Subject: [PATCH] eata: Implement shutdown callback for eata driver

Implement shutdown callback for eata driver, so eata controllers will
be put into ready state for kexec.

Signed-off-by: Jiang Liu 
---
 drivers/scsi/eata.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index ceeba4d7b4ff..f3ef9ac97646 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1517,6 +1517,11 @@ static void eata2x_pci_remove(struct pci_dev *pdev)
 	pci_disable_device(pdev);
 }
 
+static void eata2x_pci_shutdown(struct pci_dev *pdev)
+{
+	port_remove(>dev);
+}
+
 static struct pci_device_id eata2x_tbl[] = {
 	{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_SCSI << 8, PCI_ANY_ID) },
 	{ },
@@ -1528,6 +1533,7 @@ static struct pci_driver eata2x_pci_driver = {
 	.id_table	= eata2x_tbl,
 	.probe		= eata2x_pci_probe,
 	.remove		= eata2x_pci_remove,
+	.shutdown	= eata2x_pci_shutdown,
 };
 
 static int eata2x_register_pci_driver(void)
@@ -1569,8 +1575,14 @@ static int __exit eata2x_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void eata2x_platform_shutdown(struct platform_device *pdev)
+{
+	port_remove(>dev);
+}
+
 static struct platform_driver eata2x_platform_driver = {
 	.remove = __exit_p(eata2x_platform_remove),
+	.shutdown = eata2x_platform_shutdown,
 	.driver = {
 		.name	= "eata_plat",
 		.owner	= THIS_MODULE,
-- 
1.7.10.4



Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-26 Thread Arthur Marsh



Arthur Marsh wrote on 24/09/15 15:26:



Jiang Liu wrote on 24/09/15 13:58:


Hi James,
Thanks for review. How about the attached patch which addresses
the three suggestions from you?
Thanks!
Gerry


I've applied the patch, rebuilt the kernel and verified that it allows
unloading of the eata module and reloading it, as well as a successful
kexec.

Regards,

Arthur.


After some more thorough testing I've encountered an ongoing problem 
trying to use kexec with filesystems mounted with the eata driver.


If I boot up and have the eata driver loaded but no filesystem check or 
mounting of filesystems on the disk attached to the DPT2044W controller, 
then attempt a kexec reboot I get the reboot pausing after the 
"synchronizing scsi cache" messages and getting the errors that I have 
included as pictures in my previous reports.


If I do a normal boot which includes eata being loaded, the disk 
attached to the DPT2044W controller having its filesystems checked and 
mounted, then attempt a kexec reboot, I get the reboot pausing after the 
"synchronizing SCSI cache" messages as before.


If I un-mount the filesystems on the disk attached to the DPT2044W 
controller after start-up and try a reboot I get the same problem.


If I do modprobe -r eata after un-mounting the filesystems on the disk 
attached to the DPT2044W controller after a start-up kexec *works fine*.


If I do:

start-up
un-mount filesystems on disk attached to DPT2044W controller
modprobe -r eata
modprobe eata
fsck -a of filesystems on disk attached to DPT2044W controller
mount filesystems

then a kexec reboot works fine.

I did some more experimenting and found a workaround:

I was unable to blacklist the eata module but if I did:

modprobe -r eata
modprobe eata

in a cron job before the fsck and mount commands then
I could then perform a kexec reboot successfully.

I also verified that if I did:

modprobe -r eata

after eata was loaded on boot-up without any fsck or mounting of 
filesystems on the disk attached to the DPT2044W controller using the 
eata the kexec reboot worked fine.


In summary:

if eata is loaded kexec reboot will fail unless a modprobe -r eata is 
done either manually or by a cron job.


if a modprobe -r eata has been done, then even if I modprobe eata and 
fsck and mount filesystems, kexec reboot works.


Any suggestions for further tests or checks welcome.

Arthur.


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-23 Thread Arthur Marsh



Jiang Liu wrote on 23/09/15 14:54:


Hi Arthur,
I have found the cause of the warning messages, it's caused
by a flaw in the conversion. But according to my understanding,
it isn't related to the kexec/kdump failure. Could you please help
to test the attached new version?
Thanks!
Gerry



Thanks, the patch worked, I could successfully unload and reload the 
eata module, and perform a kexec reboot with the eata module loading 
successfully afterwards.


Arthur.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-23 Thread James Bottomley
On Wed, 2015-09-23 at 20:14 +0930, Arthur Marsh wrote:
> 
> Jiang Liu wrote on 23/09/15 14:54:
> 
> > Hi Arthur,
> > I have found the cause of the warning messages, it's caused
> > by a flaw in the conversion. But according to my understanding,
> > it isn't related to the kexec/kdump failure. Could you please help
> > to test the attached new version?
> > Thanks!
> > Gerry
> >
> 
> Thanks, the patch worked, I could successfully unload and reload the 
> eata module, and perform a kexec reboot with the eata module loading 
> successfully afterwards.

Great, so the bug was unconditionally unregistering the platform driver
when it would fail to attach if none of the legacy IO ports were
detected.

I think the driver needs a bit of a tidy up.  There's no need at all to
use ida_get_simple(): the only reason for a dense array of numbers was
for storing the hba private data in the array you got rid of; we can now
simply use shost->host_no ... it's more useful anyway because the
numbers match those SCSI is using.

Also, if you insist on converting the printk's to dev warn, you no
longer need to print out the driver name ... dev_printk already prints
out the device and driver name as the prefix.

The if (error == 0) is usually written as if (!error) but that's minor.

Thanks for doing the conversion,

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-23 Thread Arthur Marsh



Jiang Liu wrote on 24/09/15 13:58:


Hi James,
Thanks for review. How about the attached patch which addresses
the three suggestions from you?
Thanks!
Gerry


I've applied the patch, rebuilt the kernel and verified that it allows 
unloading of the eata module and reloading it, as well as a successful 
kexec.


Regards,

Arthur.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-23 Thread Jiang Liu
On 2015/9/23 22:40, James Bottomley wrote:
> On Wed, 2015-09-23 at 20:14 +0930, Arthur Marsh wrote:
>>
>> Jiang Liu wrote on 23/09/15 14:54:
>>
>>> Hi Arthur,
>>> I have found the cause of the warning messages, it's caused
>>> by a flaw in the conversion. But according to my understanding,
>>> it isn't related to the kexec/kdump failure. Could you please help
>>> to test the attached new version?
>>> Thanks!
>>> Gerry
>>>
>>
>> Thanks, the patch worked, I could successfully unload and reload the 
>> eata module, and perform a kexec reboot with the eata module loading 
>> successfully afterwards.
> 
> Great, so the bug was unconditionally unregistering the platform driver
> when it would fail to attach if none of the legacy IO ports were
> detected.
> 
> I think the driver needs a bit of a tidy up.  There's no need at all to
> use ida_get_simple(): the only reason for a dense array of numbers was
> for storing the hba private data in the array you got rid of; we can now
> simply use shost->host_no ... it's more useful anyway because the
> numbers match those SCSI is using.
> 
> Also, if you insist on converting the printk's to dev warn, you no
> longer need to print out the driver name ... dev_printk already prints
> out the device and driver name as the prefix.
> 
> The if (error == 0) is usually written as if (!error) but that's minor.
Hi James,
Thanks for review. How about the attached patch which addresses
the three suggestions from you?
Thanks!
Gerry


> 
> Thanks for doing the conversion,
> 
> James
> 
> 
>From aeb4859ff2c86434814cfc88f1a36481f3dcbc86 Mon Sep 17 00:00:00 2001
From: Jiang Liu 
Date: Thu, 24 Sep 2015 12:24:33 +0800
Subject: [PATCH]


Signed-off-by: Jiang Liu 
---
 drivers/scsi/eata.c |  234 +--
 1 file changed, 97 insertions(+), 137 deletions(-)

diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 11813a72c2e9..ceeba4d7b4ff 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -487,7 +487,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -818,7 +817,6 @@ struct hostdata {
 	unsigned int cp_stat[MAX_MAILBOXES];	/* FREE, IN_USE, LOCKED, IN_RESET */
 	unsigned int last_cp_used;	/* Index of last mailbox used */
 	unsigned int iocount;	/* Total i/o done for this board */
-	int board_number;	/* Number of this board */
 	char board_name[16];	/* Name of this board */
 	int in_reset;		/* True if board is doing a reset */
 	int target_to[MAX_TARGET][MAX_CHANNEL];	/* N. of timeout errors on target */
@@ -835,7 +833,6 @@ struct hostdata {
 };
 
 static const char *driver_name = "EATA";
-static DEFINE_IDA(eata2x_ida);
 static struct platform_device *eata2x_platform_devs[MAX_BOARDS];
 static bool eata2x_platform_driver_registered;
 
@@ -864,6 +861,10 @@ static unsigned long io_port[] = {
 #define DEV2H(x)   be32_to_cpu(x)
 #define H2DEV16(x) cpu_to_be16(x)
 #define DEV2H16(x) be16_to_cpu(x)
+#define dev_warn_on(dev, cond, fmt, ...)	\
+	if (cond) dev_warn(dev, fmt, ##__VA_ARGS__)
+#define dev_info_on(dev, cond, fmt, ...)	\
+	if (cond) dev_info(dev, fmt, ##__VA_ARGS__)
 
 /* But transfer orientation from the 16 bit data register is Little Endian */
 #define REG2H(x)   le16_to_cpu(x)
@@ -1029,47 +1030,32 @@ static int port_detect(unsigned long port_base, struct device *dev)
 	unsigned char dma_channel_table[4] = { 5, 6, 7, 0 };
 	struct Scsi_Host *shost;
 	struct hostdata *ha;
-	char name[16];
-	int idx, ret = -ENODEV;
-
-	idx = ida_simple_get(_ida, 0, MAX_BOARDS, GFP_KERNEL);
-	if (idx < 0) {
-		ret = idx;
-		goto fail;
-	}
+	int ret = -ENODEV;
 
 	shost = scsi_host_alloc(_template, sizeof(struct hostdata));
 	if (shost == NULL) {
-		dev_warn(dev, "%s: unable to alloc host, detaching.\n",
-			 driver_name);
+		dev_warn(dev, "unable to alloc host, detaching.\n");
 		ret = -ENOMEM;
-		goto freeid;
+		goto fail;
 	}
 
-	sprintf(name, "%s%d", driver_name, idx);
-
 	if (!request_region(port_base, REGION_SIZE, driver_name)) {
-#if defined(DEBUG_DETECT)
-		printk("%s: address 0x%03lx in use, skipping probe.\n", name,
-		   port_base);
-#endif
+		dev_warn_on(dev, config_enabled(DEBUG_DETECT),
+			"address 0x%03lx in use, skipping probe.\n",
+			port_base);
 		goto freeshost;
 	}
 
 	if (do_dma(port_base, 0, READ_CONFIG_PIO)) {
-#if defined(DEBUG_DETECT)
-		printk("%s: detect, do_dma failed at 0x%03lx.\n", name,
-		   port_base);
-#endif
+		dev_warn_on(dev, config_enabled(DEBUG_DETECT),
+			"detect, do_dma failed at 0x%03lx.\n", port_base);
 		goto freelock;
 	}
 
 	/* Read the info structure */
 	if (read_pio(port_base, (ushort *) & info, (ushort *) & info.ipad[0])) {
-#if defined(DEBUG_DETECT)
-		printk("%s: detect, read_pio failed at 0x%03lx.\n", name,
-		   port_base);
-#endif
+		dev_warn_on(dev, config_enabled(DEBUG_DETECT),
+			"detect, read_pio failed at 0x%03lx.\n", port_base);
 		goto freelock;
 	}
 
@@ 

Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-22 Thread Hannes Reinecke
On 09/22/2015 09:30 AM, Jiang Liu wrote:
> Previously the eata driver just grabs and accesses eata PCI devices
> without implementing a PCI device driver, that causes troubles with
> latest IRQ related
> 
> Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and
> pcibios_free_irq()") changes the way to allocate PCI legacy IRQ
> for PCI devices on x86 platforms. Instead of allocating PCI legacy
> IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq()
> will be called by pci_device_probe() to allocate PCI legacy IRQs
> when binding PCI drivers to PCI devices.
> 
> But the eata driver directly accesses PCI devices without implementing
> corresponding PCI drivers, so pcibios_alloc_irq() won't be called for
> those PCI devices and wrong IRQ number may be used to manage the PCI
> device.
> 
> This patch implements a PCI device driver to manage eata PCI devices,
> so eata driver could properly cooperate with the PCI core. It also
> provides headroom for PCI hotplug with eata driver.
> 
> It also represents non-PCI eata devices as platform devices, so it could
> be managed as normal devices.
> 
> Signed-off-by: Jiang Liu 
> Cc: Hannes Reinecke 
> Cc: Ballabio, Dario 
> Cc: Christoph Hellwig 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-22 Thread Jiang Liu
On 2015/9/23 7:36, Arthur Marsh wrote:
> James Bottomley wrote on 23/09/15 08:15:
>> On Wed, 2015-09-23 at 07:55 +0930, Arthur Marsh wrote:
>> It looks to be some problem in shut down.  Can you simply remove and
>> re-insert the driver successfully?  If it's your root disk driver,
>> you'll have to do this from an initrd so as not to have root mounted
>> from the eata controller.
>>
>> If the remove and reinsert fails, it means we have a problem in the
>> driver shut down.  If not, it's likely something kexec related.
>>
>> James
> 
> OK, it looks like there was a problem with unloading the driver.
> 
> After un-mounting file systems on the disk attached to the SCSI
> controller using the eata driver I could do a:
> 
> modprobe -r eata
> 
> but received the output of the attached dmesg log.
> 
> Attempting to do
> 
> modprobe eata
> 
> after the previous modprobe -r eata resulted in a complete lock-up.
Hi Arthur,
I have found the cause of the warning messages, it's caused
by a flaw in the conversion. But according to my understanding,
it isn't related to the kexec/kdump failure. Could you please help
to test the attached new version?
Thanks!
Gerry

> 
> Arthur.
>From 2231506adf7da0944fac82ec38040cc2f70562f7 Mon Sep 17 00:00:00 2001
From: Jiang Liu 
Date: Tue, 22 Sep 2015 10:16:20 +0800
Subject: [Bugfix v3] eata: Convert eata driver as normal PCI and platform
 device drivers
To: Thomas Gleixner ,
Bjorn Helgaas ,
Arthur Marsh ,
Hannes Reinecke ,
Ballabio, Dario ,
Christoph Hellwig 
Cc: linux-ker...@vger.kernel.org,
linux-...@vger.kernel.org,
linux-scsi@vger.kernel.org,
x...@kernel.org

Previously the eata driver just grabs and accesses eata PCI devices
without implementing a PCI device driver, that causes troubles with
latest IRQ related

Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and
pcibios_free_irq()") changes the way to allocate PCI legacy IRQ
for PCI devices on x86 platforms. Instead of allocating PCI legacy
IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq()
will be called by pci_device_probe() to allocate PCI legacy IRQs
when binding PCI drivers to PCI devices.

But the eata driver directly accesses PCI devices without implementing
corresponding PCI drivers, so pcibios_alloc_irq() won't be called for
those PCI devices and wrong IRQ number may be used to manage the PCI
device.

This patch implements a PCI device driver to manage eata PCI devices,
so eata driver could properly cooperate with the PCI core. It also
provides headroom for PCI hotplug with eata driver.

It also represents non-PCI eata devices as platform devices, so it could
be managed as normal devices.

Signed-off-by: Jiang Liu 
Cc: Hannes Reinecke 
Cc: Ballabio, Dario 
Cc: Christoph Hellwig 
---
 drivers/scsi/eata.c |  451 +++
 1 file changed, 272 insertions(+), 179 deletions(-)

diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 227dd2c2ec2f..11813a72c2e9 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -486,6 +486,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -503,8 +505,6 @@
 #include 
 #include 
 
-static int eata2x_detect(struct scsi_host_template *);
-static int eata2x_release(struct Scsi_Host *);
 static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
 static int eata2x_eh_abort(struct scsi_cmnd *);
 static int eata2x_eh_host_reset(struct scsi_cmnd *);
@@ -513,9 +513,9 @@ static int eata2x_bios_param(struct scsi_device *, struct block_device *,
 static int eata2x_slave_configure(struct scsi_device *);
 
 static struct scsi_host_template driver_template = {
+	.module = THIS_MODULE,
+	.proc_name = "eata2x",
 	.name = "EATA/DMA 2.0x rev. 8.10.00 ",
-	.detect = eata2x_detect,
-	.release = eata2x_release,
 	.queuecommand = eata2x_queuecommand,
 	.eh_abort_handler = eata2x_eh_abort,
 	.eh_host_reset_handler = eata2x_eh_host_reset,
@@ -834,12 +834,10 @@ struct hostdata {
 	struct mssp sp;		/* Local copy of sp buffer */
 };
 
-static struct Scsi_Host *sh[MAX_BOARDS];
 static const char *driver_name = "EATA";
-static char sha[MAX_BOARDS];
-
-/* Initialize num_boards so that ihdlr can work while detect is in progress */
-static unsigned int num_boards = MAX_BOARDS;
+static DEFINE_IDA(eata2x_ida);
+static struct platform_device *eata2x_platform_devs[MAX_BOARDS];
+static bool eata2x_platform_driver_registered;
 
 static unsigned long io_port[] = {
 
@@ -850,10 +848,6 @@ static unsigned long io_port[] = {
 	/* First ISA */
 	0x1f0,
 
-	/* Space for MAX_PCI ports possibly reported by PCI_BIOS */
-	SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP,
-	SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP,
-

Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-22 Thread Arthur Marsh



Jiang Liu wrote on 22/09/15 17:00:

Previously the eata driver just grabs and accesses eata PCI devices
without implementing a PCI device driver, that causes troubles with
latest IRQ related

Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and
pcibios_free_irq()") changes the way to allocate PCI legacy IRQ
for PCI devices on x86 platforms. Instead of allocating PCI legacy
IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq()
will be called by pci_device_probe() to allocate PCI legacy IRQs
when binding PCI drivers to PCI devices.

But the eata driver directly accesses PCI devices without implementing
corresponding PCI drivers, so pcibios_alloc_irq() won't be called for
those PCI devices and wrong IRQ number may be used to manage the PCI
device.

This patch implements a PCI device driver to manage eata PCI devices,
so eata driver could properly cooperate with the PCI core. It also
provides headroom for PCI hotplug with eata driver.

It also represents non-PCI eata devices as platform devices, so it could
be managed as normal devices.

Signed-off-by: Jiang Liu 
Cc: Hannes Reinecke 
Cc: Ballabio, Dario 
Cc: Christoph Hellwig 
---


Not really any change with this driver:

previously

http://www.users.on.net/~arthur.marsh/20150915547.jpg

now

http://www.users.on.net/~arthur.marsh/20150922553.jpg

If there was any way of capturing any more debug output I'd be happy to 
do it.


Arthur.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-22 Thread Arthur Marsh



James Bottomley wrote on 23/09/15 08:15:

On Wed, 2015-09-23 at 07:55 +0930, Arthur Marsh wrote:


Jiang Liu wrote on 22/09/15 17:00:

Previously the eata driver just grabs and accesses eata PCI devices
without implementing a PCI device driver, that causes troubles with
latest IRQ related

Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and
pcibios_free_irq()") changes the way to allocate PCI legacy IRQ
for PCI devices on x86 platforms. Instead of allocating PCI legacy
IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq()
will be called by pci_device_probe() to allocate PCI legacy IRQs
when binding PCI drivers to PCI devices.

But the eata driver directly accesses PCI devices without implementing
corresponding PCI drivers, so pcibios_alloc_irq() won't be called for
those PCI devices and wrong IRQ number may be used to manage the PCI
device.

This patch implements a PCI device driver to manage eata PCI devices,
so eata driver could properly cooperate with the PCI core. It also
provides headroom for PCI hotplug with eata driver.

It also represents non-PCI eata devices as platform devices, so it could
be managed as normal devices.

Signed-off-by: Jiang Liu 
Cc: Hannes Reinecke 
Cc: Ballabio, Dario 
Cc: Christoph Hellwig 
---


Not really any change with this driver:

previously

http://www.users.on.net/~arthur.marsh/20150915547.jpg

now

http://www.users.on.net/~arthur.marsh/20150922553.jpg

If there was any way of capturing any more debug output I'd be happy to
do it.


It looks to be some problem in shut down.  Can you simply remove and
re-insert the driver successfully?  If it's your root disk driver,
you'll have to do this from an initrd so as not to have root mounted
from the eata controller.

If the remove and reinsert fails, it means we have a problem in the
driver shut down.  If not, it's likely something kexec related.

James


OK, it looks like there was a problem with unloading the driver.

After un-mounting file systems on the disk attached to the SCSI 
controller using the eata driver I could do a:


modprobe -r eata

but received the output of the attached dmesg log.

Attempting to do

modprobe eata

after the previous modprobe -r eata resulted in a complete lock-up.

Arthur.
[0.00] Initializing cgroup subsys cpuset
[0.00] Initializing cgroup subsys cpu
[0.00] Initializing cgroup subsys cpuacct
[0.00] Linux version 4.3.0-rc2+ (root@victoria) (gcc version 5.2.1 
20150911 (Debian 5.2.1-17) ) #49 SMP PREEMPT Tue Sep 22 04:58:18 ACST 2015
[0.00] x86/fpu: Legacy x87 FPU detected.
[0.00] x86/fpu: Using 'lazy' FPU context switches.
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0009fbff] usable
[0.00] BIOS-e820: [mem 0x0009fc00-0x0009] reserved
[0.00] BIOS-e820: [mem 0x000e-0x000f] reserved
[0.00] BIOS-e820: [mem 0x0010-0x3ffa] usable
[0.00] BIOS-e820: [mem 0x3ffb-0x3ffbdfff] ACPI data
[0.00] BIOS-e820: [mem 0x3ffbe000-0x3ffd] ACPI NVS
[0.00] BIOS-e820: [mem 0x3ffe-0x3fff] reserved
[0.00] BIOS-e820: [mem 0xe000-0xefff] reserved
[0.00] BIOS-e820: [mem 0xfec0-0xfec00fff] reserved
[0.00] BIOS-e820: [mem 0xff78-0x] reserved
[0.00] Notice: NX (Execute Disable) protection cannot be enabled: 
non-PAE kernel!
[0.00] SMBIOS 2.3 present.
[0.00] DMI: System manufacturer System Product Name/A8V-MX, BIOS 0503   
 12/06/2005
[0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
[0.00] e820: remove [mem 0x000a-0x000f] usable
[0.00] e820: last_pfn = 0x3ffb0 max_arch_pfn = 0x10
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-E uncachable
[0.00]   F-F write-protect
[0.00] MTRR variable ranges enabled:
[0.00]   0 base 00 mask FFC000 write-back
[0.00]   1 base 00D000 mask FFF000 write-combining
[0.00]   2 disabled
[0.00]   3 disabled
[0.00]   4 disabled
[0.00]   5 disabled
[0.00]   6 disabled
[0.00]   7 disabled
[0.00] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT  
[0.00] found SMP MP-table at [mem 0x000ff780-0x000ff78f] mapped at 
[c00ff780]
[0.00] initial memory mapped: [mem 0x-0x023f]
[0.00] Base memory trampoline at [c009b000] 9b000 size 16384
[0.00] init_memory_mapping: [mem 0x-0x000f]
[0.00]  [mem 0x-0x000f] page 4k
[0.00] 

Re: [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers

2015-09-22 Thread James Bottomley
On Wed, 2015-09-23 at 07:55 +0930, Arthur Marsh wrote:
> 
> Jiang Liu wrote on 22/09/15 17:00:
> > Previously the eata driver just grabs and accesses eata PCI devices
> > without implementing a PCI device driver, that causes troubles with
> > latest IRQ related
> >
> > Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and
> > pcibios_free_irq()") changes the way to allocate PCI legacy IRQ
> > for PCI devices on x86 platforms. Instead of allocating PCI legacy
> > IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq()
> > will be called by pci_device_probe() to allocate PCI legacy IRQs
> > when binding PCI drivers to PCI devices.
> >
> > But the eata driver directly accesses PCI devices without implementing
> > corresponding PCI drivers, so pcibios_alloc_irq() won't be called for
> > those PCI devices and wrong IRQ number may be used to manage the PCI
> > device.
> >
> > This patch implements a PCI device driver to manage eata PCI devices,
> > so eata driver could properly cooperate with the PCI core. It also
> > provides headroom for PCI hotplug with eata driver.
> >
> > It also represents non-PCI eata devices as platform devices, so it could
> > be managed as normal devices.
> >
> > Signed-off-by: Jiang Liu 
> > Cc: Hannes Reinecke 
> > Cc: Ballabio, Dario 
> > Cc: Christoph Hellwig 
> > ---
> 
> Not really any change with this driver:
> 
> previously
> 
> http://www.users.on.net/~arthur.marsh/20150915547.jpg
> 
> now
> 
> http://www.users.on.net/~arthur.marsh/20150922553.jpg
> 
> If there was any way of capturing any more debug output I'd be happy to 
> do it.

It looks to be some problem in shut down.  Can you simply remove and
re-insert the driver successfully?  If it's your root disk driver,
you'll have to do this from an initrd so as not to have root mounted
from the eata controller.

If the remove and reinsert fails, it means we have a problem in the
driver shut down.  If not, it's likely something kexec related.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html