Skip to contentSkip to conversation

mvsas: Add driver version and interrupt coalescing to device attributes in sysfs

PATCH In review [email protected] 3 participants 13 messages May 24, 2011 – May 31, 2011 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 3/9 mvsas: Add driver version and interrupt coalescing to device attributes in sysfs

From: Xiangliang Yu <[email protected]>

-- Add support for driver version and interrupt coalescing device attributes.

---
 drivers/scsi/mvsas/mv_64xx.c |   25 +++++++++++++-
 drivers/scsi/mvsas/mv_94xx.c |   26 ++++++++++++++-
 drivers/scsi/mvsas/mv_init.c |   75 ++++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/mvsas/mv_sas.h  |    2 +
 4 files changed, 126 insertions(+), 2 deletions(-)
drivers/scsi/mvsas/mv_64xx.c +24 -1
index 0e13e64..c88b8a7 100644
@@ -402,7 +402,7 @@ static int __devinit mvs_64xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -758,6 +758,28 @@ void mvs_64xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
 }
 #endif
 
+static void mvs_64xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+}
+
 const struct mvs_dispatch mvs_64xx_dispatch = {
 	"mv64xx",
 	mvs_64xx_init,
@@ -811,6 +833,7 @@ const struct mvs_dispatch mvs_64xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_64xx_fix_dma,
 #endif
+	mvs_64xx_tune_interrupt,
 	NULL,
 };
 
drivers/scsi/mvsas/mv_94xx.c +25 -1
index 3f2ad93..e589f31 100644
@@ -475,7 +475,7 @@ static int __devinit mvs_94xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -894,6 +894,29 @@ static void mvs_94xx_clear_srs_irq(struct mvs_info *mvi, u8 reg_set,
 {
 }
 
+static void mvs_94xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+
+}
+
 const struct mvs_dispatch mvs_94xx_dispatch = {
 	"mv94xx",
 	mvs_94xx_init,
@@ -947,6 +970,7 @@ const struct mvs_dispatch mvs_94xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_94xx_fix_dma,
 #endif
+	mvs_94xx_tune_interrupt,
 	mvs_94xx_non_spec_ncq_error,
 };
 
drivers/scsi/mvsas/mv_init.c +75 -0

105 lines not on this page · raw message

drivers/scsi/mvsas/mv_sas.h +2 -0
index 8740b78..fed8495 100644
@@ -64,6 +64,7 @@
 #endif
 #define MV_MAX_U32			0xffffffff
 
+extern int interrupt_coalescing;
 extern struct mvs_tgt_initiator mvs_tgt;
 extern struct mvs_info *tgt_mvi;
 extern const struct mvs_dispatch mvs_64xx_dispatch;
@@ -170,6 +171,7 @@ struct mvs_dispatch {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	void (*dma_fix)(dma_addr_t buf_dma, int buf_len, int from, void *prd);
 #endif
+	void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
 	void (*non_spec_ncq_error)(struct mvs_info *mvi);
 
 };
Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 3 lines · On Tue, May 24, 2011 at 10:31:47PM +0800, [email protected] wrote:

From: Xiangliang Yu <[email protected]>

-- Add support for driver version and interrupt coalescing device attributes.

When you add a sysfs file, you must also add a Documentation/ABI file as well. Please do that here.

thanks,

greg k-h

#2 lore raw
Quoted 7 lines

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >coalescing to device attributes in sysfs

Quoted 2 lines

-- Add support for driver version and interrupt coalescing device attributes.

When you add a sysfs file, you must also add a Documentation/ABI file as well. Please do that here.

These device attributes are sysft class properties for the scsi host, and the
sysfs files are within scsi host sysfs directory. so, do you think I need add a ABI file? and , I can't find anything about scsi host sysfs file under directory Documentation/ABI. Thanks!

#3 lore raw
Quoted 5 lines · Xiangliang Yu
Quoted 4 lines

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >coalescing to device attributes in sysfs

Quoted 2 lines

-- Add support for driver version and interrupt coalescing device attributes.

Quoted 7 lines
Quoted 2 lines

When you add a sysfs file, you must also add a Documentation/ABI file as well. Please do that here.

These device attributes are sysft class properties for the scsi host, and the sysfs files are within scsi host sysfs directory. so, do you think I need add a ABI file? and , I can't find anything about scsi host sysfs file under directory Documentation/ABI.

Yes, again, if you add a sysfs file, you need to add documentation explaining exactly what it is there for and what it does.

And if there isn't already a file for this device, then please add it.

thanks,

greg k-h

#4 lore raw
Quoted 16 lines
Quoted 8 lines
Quoted 3 lines

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >>>coalescing to device attributes in sysfs

On Thu, May 26, 2011 at 02:00:21AM -0700, Xiangliang Yu wrote:

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >coalescing to device attributes in sysfs

Quoted 3 lines

-- Add support for driver version and interrupt coalescing device attributes.

Quoted 7 lines
Quoted 2 lines

When you add a sysfs file, you must also add a Documentation/ABI file as well. Please do that here.

These device attributes are sysft class properties for the scsi host, and the sysfs files are within scsi host sysfs directory. so, do you think I need add a ABI file? and , I can't find anything about scsi host sysfs file under directory Documentation/ABI.

Quoted 4 lines

Yes, again, if you add a sysfs file, you need to add documentation explaining exactly what it is there for and what it does.

And if there isn't already a file for this device, then please add it.

How about this:

.../ABI/testing/sysfs-bus-pci-scsi-devices-mvsas | 13 +++++++++++++

 1 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas
Documentation/ABI/testing/sysfs-bus-pci-scsi renamed from Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas +0 -0

-devices-mvsas
new file mode 100644
index 0000000..45f597e

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +13 -0
@@ -0,0 +1,13 @@
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/driver_version
+Date:          May 2011
+Kernel Version:        2.6.39
+Contact:       [email protected]
+Description:   Display the mvsas drivers version
+
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:          May 2011
+Kernel Version:        2.6.39
+Contact:       [email protected]
+Description:   Determines the maximum time the 88SE94XX waits after the occurrence of a
+               Command Done before generating an interrupt.The maximum number of the 
+               variable is less than 0x10000.
#5 lore raw
Quoted 33 lines · Xiangliang Yu
Quoted 16 lines
Quoted 8 lines
Quoted 3 lines

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >>>coalescing to device attributes in sysfs

On Thu, May 26, 2011 at 02:00:21AM -0700, Xiangliang Yu wrote:

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >coalescing to device attributes in sysfs

Quoted 3 lines

-- Add support for driver version and interrupt coalescing device attributes.

Quoted 7 lines
Quoted 2 lines

When you add a sysfs file, you must also add a Documentation/ABI file as well. Please do that here.

These device attributes are sysft class properties for the scsi host, and the sysfs files are within scsi host sysfs directory. so, do you think I need add a ABI file? and , I can't find anything about scsi host sysfs file under directory Documentation/ABI.

Quoted 4 lines

Yes, again, if you add a sysfs file, you need to add documentation explaining exactly what it is there for and what it does.

And if there isn't already a file for this device, then please add it.

How about this:

.../ABI/testing/sysfs-bus-pci-scsi-devices-mvsas | 13 +++++++++++++

 1 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas
Documentation/ABI/testing/sysfs-bus-pci-scsi renamed from Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas +0 -1
-devices-mvsas

new file mode 100644
index 0000000..45f597e

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 5

Quoted 5 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +5 -0
@@ -0,0 +1,13 @@
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/driver_version
+Date:          May 2011
+Kernel Version:        2.6.39
+Contact:       [email protected]
+Description:   Display the mvsas drivers version

A driver version should never show up down here in sysfs, use the proper place for this like the rest of the kernel's drivers do (hint, look at MODULE_VERSION() and where that ends up, in your module's sysfs directory.)

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 9

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +3 -0
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:          May 2011
+Kernel Version:        2.6.39

2.6.39 was released already, is this file in that release?

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 13

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +4 -0
+Contact:       [email protected]
+Description:   Determines the maximum time the 88SE94XX waits after the occurrence of a
+               Command Done before generating an interrupt.The maximum number of the 
+               variable is less than 0x10000.

Why would a user, or anyone else, ever want to be able to change this? Why wouldn't this just be something that the driver handles automagically so the user never has to worry about it at all?

You also don't specify the units involved here, which is not good.

See, when you document things, it's easier to notice when you did something you didn't need to do (i.e. the driver version thing). :)

thanks,

greg k-h

#6 lore raw
Quoted 35 lines · Xiangliang Yu
Quoted 35 lines
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >>>>coalescing to device attributes in sysfs

On Thu, May 26, 2011 at 02:00:21AM -0700, Xiangliang Yu wrote:

Subject: Re: [PATCH 3/9] [SCSI] mvsas: Add driver version and interrupt >>coalescing to device attributes in sysfs

Quoted 5 lines

-- Add support for driver version and interrupt coalescing device attributes.

When you add a sysfs file, you must also add a Documentation/ABI file as well. Please do that here.

These device attributes are sysft class properties for the scsi host,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

and the sysfs files are within scsi host sysfs directory. so, do you

think I need add a ABI file? and , I can't find anything about scsi host sysfs file under directory Documentation/ABI.

Yes, again, if you add a sysfs file, you need to add documentation explaining exactly what it is there for and what it does.

And if there isn't already a file for this device, then please add it.

How about this:

.../ABI/testing/sysfs-bus-pci-scsi-devices-mvsas | 13 +++++++++++++

 1 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas
Documentation/ABI/testing/sysfs-bus-pci-scsi renamed from Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas +0 -1
-devices-mvsas

new file mode 100644
index 0000000..45f597e

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +2 -0
@@ -0,0 +1,13 @@
+What:          >/sys/devices/pci/<devices>/<dev>/host/scsi_host/host/driver_version
+Date:          May 2011
Quoted 8 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 5

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +3 -0
+Kernel Version:        2.6.39
+Contact:       [email protected]
+Description:   Display the mvsas drivers version

A driver version should never show up down here in sysfs, use the proper place for this like the rest of the kernel's drivers do (hint, look at MODULE_VERSION() and where that ends up, in your module's sysfs directory.)

OK! Thanks!

Quoted 5 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 8

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +3 -0
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:          May 2011
+Kernel Version:        2.6.39

2.6.39 was released already, is this file in that release?

Yes.

Quoted 6 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 12

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +4 -0
+Contact:       [email protected]
+Description:   Determines the maximum time the 88SE94XX waits after the occurrence of a
+               Command Done before generating an interrupt.The maximum number of the 
+               variable is less than 0x10000.

Why would a user, or anyone else, ever want to be able to change this?

Because different platform can get better performance by setting different value

Quoted 2 lines

Why wouldn't this just be something that the driver handles automagically so the user never has to worry about it at all?

As for now, driver can't do it. The value need to be test, and get the best.

Quoted 1 line

You also don't specify the units involved here, which is not good.

OK, thanks!

Quoted 2 lines

See, when you document things, it's easier to notice when you did something you didn't need to do (i.e. the driver version thing). :)

Yes, thanks!

I modify this patch, pls review it, thanks!

.../ABI/testing/sysfs-bus-pci-scsi-devices-mvsas   |    7 ++
 drivers/scsi/mvsas/mv_64xx.c                       |   25 ++++++++-
 drivers/scsi/mvsas/mv_94xx.c                       |   26 ++++++++-
 drivers/scsi/mvsas/mv_init.c                       |   62 ++++++++++++++++++++
 drivers/scsi/mvsas/mv_sas.h                        |    2 +
 5 files changed, 120 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +7 -0
new file mode 100644
index 0000000..fe8a87c
@@ -0,0 +1,7 @@
+What:		/sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:		May 2011
+Kernel Version:	2.6.39
+Contact:	[email protected]
+Description:	Determines the maximum time the 88SE94XX waits after the occurrence of a
+		Command Done before generating an interrupt.You can get better HBA performance
+		by changing interrupt_coalescing value.
drivers/scsi/mvsas/mv_64xx.c +24 -1
index 0e13e64..c88b8a7 100644
@@ -402,7 +402,7 @@ static int __devinit mvs_64xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -758,6 +758,28 @@ void mvs_64xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
 }
 #endif
 
+static void mvs_64xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+}
+
 const struct mvs_dispatch mvs_64xx_dispatch = {
 	"mv64xx",
 	mvs_64xx_init,
@@ -811,6 +833,7 @@ const struct mvs_dispatch mvs_64xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_64xx_fix_dma,
 #endif
+	mvs_64xx_tune_interrupt,
 	NULL,
 };
 
drivers/scsi/mvsas/mv_94xx.c +25 -1
index 3f2ad93..e589f31 100644
@@ -475,7 +475,7 @@ static int __devinit mvs_94xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -894,6 +894,29 @@ static void mvs_94xx_clear_srs_irq(struct mvs_info *mvi, u8 reg_set,
 {
 }
 
+static void mvs_94xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+
+}
+
 const struct mvs_dispatch mvs_94xx_dispatch = {
 	"mv94xx",
 	mvs_94xx_init,
@@ -947,6 +970,7 @@ const struct mvs_dispatch mvs_94xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_94xx_fix_dma,
 #endif
+	mvs_94xx_tune_interrupt,
 	mvs_94xx_non_spec_ncq_error,
 };
 
drivers/scsi/mvsas/mv_init.c +62 -0

92 lines not on this page · raw message

drivers/scsi/mvsas/mv_sas.h +2 -0
index 8740b78..fed8495 100644
@@ -64,6 +64,7 @@
 #endif
 #define MV_MAX_U32			0xffffffff
 
+extern int interrupt_coalescing;
 extern struct mvs_tgt_initiator mvs_tgt;
 extern struct mvs_info *tgt_mvi;
 extern const struct mvs_dispatch mvs_64xx_dispatch;
@@ -170,6 +171,7 @@ struct mvs_dispatch {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	void (*dma_fix)(dma_addr_t buf_dma, int buf_len, int from, void *prd);
 #endif
+	void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
 	void (*non_spec_ncq_error)(struct mvs_info *mvi);
 
 };
Signature · 1 line
1.7.4.4
#7 lore raw
Quoted 6 lines · Xiangliang Yu
Quoted 5 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 3

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +3 -0
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:          May 2011
+Kernel Version:        2.6.39

2.6.39 was released already, is this file in that release?

Yes.

How, doesn't your patch below implement that option? How can it already be in the .39 kernel?

Quoted 7 lines
Quoted 6 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +4 -0
+Contact:       [email protected]
+Description:   Determines the maximum time the 88SE94XX waits after the occurrence of a
+               Command Done before generating an interrupt.The maximum number of the 
+               variable is less than 0x10000.

Why would a user, or anyone else, ever want to be able to change this?

Because different platform can get better performance by setting different value

Then you need to document _how_ to do this tuning, and why someone would want to, and lots of other stuff. Don't just blindly let userspace change a value that they know nothing about.

Quoted 3 lines
Quoted 2 lines

Why wouldn't this just be something that the driver handles automagically so the user never has to worry about it at all?

As for now, driver can't do it. The value need to be test, and get the best.

Why don't you test it and set it to the proper value now? What would change in a user's system that require this to be changed? Size of the machine? Number of disks? Something else?

It really should be automatic, people do not ever want to have to manually tune their machines anymore they should be smart enough to determine the load on them and make the changes without any user needing to do it for them.

thanks,

greg k-h

#8 lore raw
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas line 3

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +3 -0
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:          May 2011
+Kernel Version:        2.6.39

2.6.39 was released already, is this file in that release?

Yes.

How, doesn't your patch below implement that option? How can it already be in the .39 kernel?

oh, that is my fault, I read the README and find out the misunderstanding of Kernel Version. How about 2.6.40?

Quoted 11 lines
Quoted 7 lines
Quoted 6 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +4 -0
+Contact:       [email protected]
+Description:   Determines the maximum time the 88SE94XX waits after the occurrence of a
+               Command Done before generating an interrupt.The maximum number of the 
+               variable is less than 0x10000.

Why would a user, or anyone else, ever want to be able to change this?

Because different platform can get better performance by setting different value

Then you need to document _how_ to do this tuning, and why someone would want to, and lots of other stuff. Don't just blindly let userspace change a value that they know nothing about.

How about this HOW_TO: you can get a better I/O throughput by decreasing the value of Interrupt coalescing, or you can get a better CPU think time if you increase the value.

Quoted 10 lines
Quoted 3 lines
Quoted 3 lines

Why wouldn't this just be something that the driver handles automagically so the user never has to worry about it at all?
As for now, driver can't do it. The value need to be test, and get the best.

Why don't you test it and set it to the proper value now? What would change in a user's system that require this to be changed? Size of the machine? Number of disks? Something else?
It really should be automatic, people do not ever want to have to manually tune their machines anymore they should be smart enough to determine the load on them and make the changes without any user needing to do it for them.

The default value is best for normal situation, but sometime user need to tune
The value. For example, the system has more than 16 SATA SSD disks, CPU need more time to schedule other jobs while running I/O, but the user want to do lots of other jobs at the same time, so, the user can write a bigger number to the sysfs, the CPU can execute other jobs more quickly. This is a balance between CPU think time and I/O throughput. But the value is depend on the system environment, like as: disk number, what kind of platform, etc. Actually, the most important reason for tuning is what the user want, I/O throughput or think time.
By default, the value don't need to be changed.

#9 lore raw
Quoted 5 lines · Xiangliang Yu
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +3 -0
+What:          /sys/devices/pci/<devices>/<dev>/host/scsi_host/host/interrupt_coalescing
+Date:          May 2011
+Kernel Version:        2.6.39
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

2.6.39 was released already, is this file in that release?

Yes.

How, doesn't your patch below implement that option? How can it already be in the .39 kernel?

oh, that is my fault, I read the README and find out the misunderstanding of Kernel Version. How about 2.6.40?

There never will be such a kernel release number, sorry.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-pci-scsi-devices-mvsas new file +4 -0
+Contact:       [email protected]
+Description:   Determines the maximum time the 88SE94XX waits after the occurrence of a
+               Command Done before generating an interrupt.The maximum number of the 
+               variable is less than 0x10000.

Why would a user, or anyone else, ever want to be able to change this?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Because different platform can get better performance by setting different value

Then you need to document _how_ to do this tuning, and why someone would want to, and lots of other stuff. Don't just blindly let userspace change a value that they know nothing about.

How about this HOW_TO: you can get a better I/O throughput by decreasing the value of Interrupt coalescing, or you can get a better CPU think time if you increase the value.

I still don't konw what you mean by this. And you really want the ability to change this stepping by 0x10000 individual choices?

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Quoted 3 lines

Why wouldn't this just be something that the driver handles automagically so the user never has to worry about it at all?
As for now, driver can't do it. The value need to be test, and get the best.

Why don't you test it and set it to the proper value now? What would change in a user's system that require this to be changed? Size of the machine? Number of disks? Something else?
It really should be automatic, people do not ever want to have to manually tune their machines anymore they should be smart enough to determine the load on them and make the changes without any user needing to do it for them.

Quoted 10 lines

The default value is best for normal situation, but sometime user need to tune The value. For example, the system has more than 16 SATA SSD disks, CPU need more time to schedule other jobs while running I/O, but the user want to do lots of other jobs at the same time, so, the user can write a bigger number to the sysfs, the CPU can execute other jobs more quickly. This is a balance between CPU think time and I/O throughput. But the value is depend on the system environment, like
as: disk number, what kind of platform, etc. Actually, the most important reason for tuning is what the user want, I/O throughput or think time.

But that's up to the block scheduler, not your driver, right? Why would the driver matter here at all?

And again, 0x10000 different choices? That's crazy.

Quoted 1 line

By default, the value don't need to be changed.

Then I would strongly recommend never exporting this value to allow it to be changed at all then. It doesn't sound worth it.

greg k-h

#10 lore raw
Quoted 3 lines

Then I would strongly recommend never exporting this value to allow it to be changed at all then. It doesn't sound worth it.

OK, Thanks!
I remove the sysfs file and the modified patch is:

drivers/scsi/mvsas/mv_64xx.c | 25 ++++++++++++++++++++++++-

 drivers/scsi/mvsas/mv_94xx.c |   26 +++++++++++++++++++++++++-
 drivers/scsi/mvsas/mv_init.c |    5 +++++
 drivers/scsi/mvsas/mv_sas.h  |    2 ++
 4 files changed, 56 insertions(+), 2 deletions(-)
drivers/scsi/mvsas/mv_64xx.c +24 -1
index 0e13e64..c88b8a7 100644
@@ -402,7 +402,7 @@ static int __devinit mvs_64xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -758,6 +758,28 @@ void mvs_64xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
 }
 #endif
 
+static void mvs_64xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+}
+
 const struct mvs_dispatch mvs_64xx_dispatch = {
 	"mv64xx",
 	mvs_64xx_init,
@@ -811,6 +833,7 @@ const struct mvs_dispatch mvs_64xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_64xx_fix_dma,
 #endif
+	mvs_64xx_tune_interrupt,
 	NULL,
 };
 
drivers/scsi/mvsas/mv_94xx.c +25 -1
index 3f2ad93..e589f31 100644
@@ -475,7 +475,7 @@ static int __devinit mvs_94xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -894,6 +894,29 @@ static void mvs_94xx_clear_srs_irq(struct mvs_info *mvi, u8 reg_set,
 {
 }
 
+static void mvs_94xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+
+}
+
 const struct mvs_dispatch mvs_94xx_dispatch = {
 	"mv94xx",
 	mvs_94xx_init,
@@ -947,6 +970,7 @@ const struct mvs_dispatch mvs_94xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_94xx_fix_dma,
 #endif
+	mvs_94xx_tune_interrupt,
 	mvs_94xx_non_spec_ncq_error,
 };
 
drivers/scsi/mvsas/mv_init.c +5 -0
index 9f1cccc..d977684 100644
@@ -34,6 +34,8 @@ MODULE_PARM_DESC(collector, "\n"
 	"\tThe mvsas SAS LLDD supports both modes.\n"
 	"\tDefault: 1 (Direct Mode).\n");
 
+int interrupt_coalescing = 0x80;
+
 static struct scsi_transport_template *mvs_stt;
 struct kmem_cache *mvs_task_list_cache;
 static const struct mvs_chip_info mvs_chips[] = {
@@ -48,6 +50,8 @@ static const struct mvs_chip_info mvs_chips[] = {
 	[chip_1320] =	{ 2, 4, 0x800, 17, 64,  9, &mvs_94xx_dispatch, },
 };
 
+struct device_attribute *mvst_host_attrs[] = { NULL };
+
 #define SOC_SAS_NUM 2
 #define SG_MX 64
 
@@ -74,6 +78,7 @@ static struct scsi_host_template mvs_sht = {
 	.slave_alloc		= mvs_slave_alloc,
 	.target_destroy		= sas_target_destroy,
 	.ioctl			= sas_ioctl,
+	.shost_attrs		= mvst_host_attrs,
 };
 
 static struct sas_domain_function_template mvs_transport_ops = {
drivers/scsi/mvsas/mv_sas.h +2 -0
index 8740b78..fed8495 100644
@@ -64,6 +64,7 @@
 #endif
 #define MV_MAX_U32			0xffffffff
 
+extern int interrupt_coalescing;
 extern struct mvs_tgt_initiator mvs_tgt;
 extern struct mvs_info *tgt_mvi;
 extern const struct mvs_dispatch mvs_64xx_dispatch;
@@ -170,6 +171,7 @@ struct mvs_dispatch {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	void (*dma_fix)(dma_addr_t buf_dma, int buf_len, int from, void *prd);
 #endif
+	void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
 	void (*non_spec_ncq_error)(struct mvs_info *mvi);
 
 };
Signature · 1 line
1.7.4.4
#11 lore raw
Quoted 5 lines · Xiangliang Yu
Quoted 3 lines

Then I would strongly recommend never exporting this value to allow it to be changed at all then. It doesn't sound worth it.

OK, Thanks!
I remove the sysfs file and the modified patch is:

Thanks for removing it, but you still left part of it in the patch, see below.

drivers/scsi/mvsas/mv_init.c MODULE_PARM_DESC(collector, "\n" · line 37

Quoted 9 lines
drivers/scsi/mvsas/mv_init.c +1 -0
index 9f1cccc..d977684 100644
@@ -34,6 +34,8 @@ MODULE_PARM_DESC(collector, "\n"
 	"\tThe mvsas SAS LLDD supports both modes.\n"
 	"\tDefault: 1 (Direct Mode).\n");
 
+int interrupt_coalescing = 0x80;

This should be named something else, or made static, as you just made it a global name, which is not good at all.

Quoted 10 lines
drivers/scsi/mvsas/mv_init.c +2 -0
@@ -48,6 +50,8 @@ static const struct mvs_chip_info mvs_chips[] = {
 	[chip_1320] =	{ 2, 4, 0x800, 17, 64,  9, &mvs_94xx_dispatch, },
 };
 
+struct device_attribute *mvst_host_attrs[] = { NULL };
+
 #define SOC_SAS_NUM 2
 #define SG_MX 64
 

drivers/scsi/mvsas/mv_init.c static struct scsi_host_template mvs_sht = { · line 81

Quoted 4 lines
drivers/scsi/mvsas/mv_init.c +1 -0
@@ -74,6 +78,7 @@ static struct scsi_host_template mvs_sht = {
 	.slave_alloc		= mvs_slave_alloc,
 	.target_destroy		= sas_target_destroy,
 	.ioctl			= sas_ioctl,
+	.shost_attrs		= mvst_host_attrs,

Here, you don't need these at all now, right?

thanks,

greg k-h

#12 lore raw
Quoted 18 lines
Quoted 6 lines
Quoted 4 lines

Then I would strongly recommend never exporting this value to allow it to be changed at all then. It doesn't sound worth it.

OK, Thanks!
I remove the sysfs file and the modified patch is:

Thanks for removing it, but you still left part of it in the patch, see below.

Quoted 8 lines
drivers/scsi/mvsas/mv_init.c +0 -0
index 9f1cccc..d977684 100644
@@ -34,6 +34,8 @@ MODULE_PARM_DESC(collector, "\n"
 	"\tThe mvsas SAS LLDD supports both modes.\n"
 	"\tDefault: 1 (Direct Mode).\n");
 
Quoted 4 lines

drivers/scsi/mvsas/mv_init.c MODULE_PARM_DESC(collector, "\n" · line 37

Quoted 1 line
drivers/scsi/mvsas/mv_init.c +1 -0
+int interrupt_coalescing = 0x80;

This should be named something else, or made static, as you just made it a global name, which is not good at all.

OK, thanks!

Quoted 9 lines
Quoted 9 lines
drivers/scsi/mvsas/mv_init.c +2 -0
@@ -48,6 +50,8 @@ static const struct mvs_chip_info mvs_chips[] = {
 	[chip_1320] =	{ 2, 4, 0x800, 17, 64,  9, &mvs_94xx_dispatch, },
 };
 
+struct device_attribute *mvst_host_attrs[] = { NULL };
+
 #define SOC_SAS_NUM 2
 #define SG_MX 64
 
Quoted 7 lines

drivers/scsi/mvsas/mv_init.c static struct scsi_host_template mvs_sht = { · line 81

Quoted 5 lines
drivers/scsi/mvsas/mv_init.c +1 -0
@@ -74,6 +78,7 @@ static struct scsi_host_template mvs_sht = {
 	.slave_alloc		= mvs_slave_alloc,
 	.target_destroy		= sas_target_destroy,
 	.ioctl			= sas_ioctl,
+	.shost_attrs		= mvst_host_attrs,

Here, you don't need these at all now, right?

I think I may need these someday, but I can remove these. Anyway, thanks!

drivers/scsi/mvsas/mv_64xx.c | 25 ++++++++++++++++++++++++-

 drivers/scsi/mvsas/mv_94xx.c  |   26 +++++++++++++++++++++++++-
 drivers/scsi/mvsas/mv_chips.h |    2 ++
 drivers/scsi/mvsas/mv_sas.h   |    1 +
 4 files changed, 52 insertions(+), 2 deletions(-)
drivers/scsi/mvsas/mv_64xx.c +24 -1
index 0e13e64..c88b8a7 100644
@@ -402,7 +402,7 @@ static int __devinit mvs_64xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -758,6 +758,28 @@ void mvs_64xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
 }
 #endif
 
+static void mvs_64xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+}
+
 const struct mvs_dispatch mvs_64xx_dispatch = {
 	"mv64xx",
 	mvs_64xx_init,
@@ -811,6 +833,7 @@ const struct mvs_dispatch mvs_64xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_64xx_fix_dma,
 #endif
+	mvs_64xx_tune_interrupt,
 	NULL,
 };
 
drivers/scsi/mvsas/mv_94xx.c +25 -1
index 3f2ad93..e589f31 100644
@@ -475,7 +475,7 @@ static int __devinit mvs_94xx_init(struct mvs_info *mvi)
 	tmp = 0;
 	mw32(MVS_INT_COAL, tmp);
 
-	tmp = 0x100;
+	tmp = 0x10000 | interrupt_coalescing;
 	mw32(MVS_INT_COAL_TMOUT, tmp);
 
 	/* ladies and gentlemen, start your engines */
@@ -894,6 +894,29 @@ static void mvs_94xx_clear_srs_irq(struct mvs_info *mvi, u8 reg_set,
 {
 }
 
+static void mvs_94xx_tune_interrupt(struct mvs_info *mvi, u32 time)
+{
+	void __iomem *regs = mvi->regs;
+	u32 tmp = 0;
+	/* interrupt coalescing may cause missing HW interrput in some case,
+	 * and the max count is 0x1ff, while our max slot is 0x200,
+	 * it will make count 0.
+	 */
+	if (time == 0) {
+		mw32(MVS_INT_COAL, 0);
+		mw32(MVS_INT_COAL_TMOUT, 0x10000);
+	} else {
+		if (MVS_CHIP_SLOT_SZ > 0x1ff)
+			mw32(MVS_INT_COAL, 0x1ff|COAL_EN);
+		else
+			mw32(MVS_INT_COAL, MVS_CHIP_SLOT_SZ|COAL_EN);
+
+		tmp = 0x10000 | time;
+		mw32(MVS_INT_COAL_TMOUT, tmp);
+	}
+
+}
+
 const struct mvs_dispatch mvs_94xx_dispatch = {
 	"mv94xx",
 	mvs_94xx_init,
@@ -947,6 +970,7 @@ const struct mvs_dispatch mvs_94xx_dispatch = {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	mvs_94xx_fix_dma,
 #endif
+	mvs_94xx_tune_interrupt,
 	mvs_94xx_non_spec_ncq_error,
 };
 
drivers/scsi/mvsas/mv_chips.h +2 -0
index 4519f80..850eb73 100644
@@ -41,6 +41,8 @@
 #define iow8(reg, val) 		outb((unsigned long)(val, regs + reg))
 #define ior8(reg) 		inb((unsigned long)(regs + reg))
 
+static int interrupt_coalescing = 0x80;
+
 static inline u32 mvs_cr32(struct mvs_info *mvi, u32 addr)
 {
 	void __iomem *regs = mvi->regs;
drivers/scsi/mvsas/mv_sas.h +1 -0
index 8740b78..847e374 100644
@@ -170,6 +170,7 @@ struct mvs_dispatch {
 #ifndef DISABLE_HOTPLUG_DMA_FIX
 	void (*dma_fix)(dma_addr_t buf_dma, int buf_len, int from, void *prd);
 #endif
+	void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
 	void (*non_spec_ncq_error)(struct mvs_info *mvi);
 
 };
Signature · 1 line
1.7.4.4