All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.4 0/2] Backports for stable 4.4
@ 2016-10-18  7:21 Juerg Haefliger
  2016-10-18  7:26 ` [PATCH 4.4 1/2] sd: Fix rw_max for devices that report an optimal xfer size Juerg Haefliger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Juerg Haefliger @ 2016-10-18  7:21 UTC (permalink / raw)
  To: stable, gregkh; +Cc: Juerg Haefliger

The first commit fixes an issue with spare RAID drives being woken up
and causing IO delays.

The second commit was meant to be included in 4.4 but never landed.

Don Brace (1):
  hpsa: correct skipping masked peripherals

Martin K. Petersen (1):
  sd: Fix rw_max for devices that report an optimal xfer size

 drivers/scsi/hpsa.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 drivers/scsi/sd.c   |  8 +++---
 drivers/scsi/sd.h   |  5 ++++
 3 files changed, 83 insertions(+), 8 deletions(-)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4.4 1/2] sd: Fix rw_max for devices that report an optimal xfer size
  2016-10-18  7:21 [PATCH 4.4 0/2] Backports for stable 4.4 Juerg Haefliger
@ 2016-10-18  7:26 ` Juerg Haefliger
  2016-10-18  7:27 ` [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals Juerg Haefliger
  2016-10-26  9:20 ` [PATCH 4.4 0/2] Backports for stable 4.4 Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Juerg Haefliger @ 2016-10-18  7:26 UTC (permalink / raw)
  To: stable, gregkh; +Cc: martin.petersen, juerg.haefliger

From: "Martin K. Petersen" <martin.petersen@oracle.com>

commit 6b7e9cde49691e04314342b7dce90c67ad567fcc upstream.

For historic reasons, io_opt is in bytes and max_sectors in block layer
sectors. This interface inconsistency is error prone and should be
fixed. But for 4.4--4.7 let's make the unit difference explicit via a
wrapper function.

Fixes: d0eb20a863ba ("sd: Optimal I/O size is in bytes, not sectors")
Cc: stable@vger.kernel.org # 4.4+
Reported-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Andrew Patterson <andrew.patterson@hpe.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
---
 drivers/scsi/sd.c | 8 ++++----
 drivers/scsi/sd.h | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0d7c6e86f149..6ee50742f6a5 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2879,10 +2879,10 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	if (sdkp->opt_xfer_blocks &&
 	    sdkp->opt_xfer_blocks <= dev_max &&
 	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
-	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
-		rw_max = q->limits.io_opt =
-			sdkp->opt_xfer_blocks * sdp->sector_size;
-	else
+	    logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_CACHE_SIZE) {
+		q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
+		rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
+	} else
 		rw_max = BLK_DEF_MAX_SECTORS;
 
 	/* Combine with controller limits */
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 654630bb7d0e..765a6f1ac1b7 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -151,6 +151,11 @@ static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blo
 	return blocks << (ilog2(sdev->sector_size) - 9);
 }
 
+static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t blocks)
+{
+	return blocks * sdev->sector_size;
+}
+
 /*
  * A DIF-capable target device can be formatted with different
  * protection schemes.  Currently 0 through 3 are defined:
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals
  2016-10-18  7:21 [PATCH 4.4 0/2] Backports for stable 4.4 Juerg Haefliger
  2016-10-18  7:26 ` [PATCH 4.4 1/2] sd: Fix rw_max for devices that report an optimal xfer size Juerg Haefliger
@ 2016-10-18  7:27 ` Juerg Haefliger
  2016-10-31 19:05   ` Jiri Slaby
  2016-10-26  9:20 ` [PATCH 4.4 0/2] Backports for stable 4.4 Greg KH
  2 siblings, 1 reply; 6+ messages in thread
From: Juerg Haefliger @ 2016-10-18  7:27 UTC (permalink / raw)
  To: stable, gregkh; +Cc: don.brace, juerg.haefliger

From: Don Brace <don.brace@microsemi.com>

commit 64ce60cab24603ac0fcd59c9fbc3be78f4c4d229 upstream.

The SA controller spins down RAID drive spares.

A REGNEWD event causes an inquiry to be sent to all physical
drives. This causes the SA controller to spin up the spare.

The controller suspends all I/O to a logical volume until
the spare is spun up. The spin-up can take over 50 seconds.

This can result in one or both of the following:
 - SML sends down aborts and resets to the logical volume
   and can cause the logical volume to be off-lined.
 - a negative impact on the logical volume's I/O performance
   each time a REGNEWD is triggered.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
---
 drivers/scsi/hpsa.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 74 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a3860367b568..e9ce74afd13f 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3930,6 +3930,70 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h,
 	return rc;
 }
 
+static bool hpsa_is_disk_spare(struct ctlr_info *h, u8 *lunaddrbytes)
+{
+	struct bmic_identify_physical_device *id_phys;
+	bool is_spare = false;
+	int rc;
+
+	id_phys = kzalloc(sizeof(*id_phys), GFP_KERNEL);
+	if (!id_phys)
+		return false;
+
+	rc = hpsa_bmic_id_physical_device(h,
+					lunaddrbytes,
+					GET_BMIC_DRIVE_NUMBER(lunaddrbytes),
+					id_phys, sizeof(*id_phys));
+	if (rc == 0)
+		is_spare = (id_phys->more_flags >> 6) & 0x01;
+
+	kfree(id_phys);
+	return is_spare;
+}
+
+#define RPL_DEV_FLAG_NON_DISK                           0x1
+#define RPL_DEV_FLAG_UNCONFIG_DISK_REPORTING_SUPPORTED  0x2
+#define RPL_DEV_FLAG_UNCONFIG_DISK                      0x4
+
+#define BMIC_DEVICE_TYPE_ENCLOSURE  6
+
+static bool hpsa_skip_device(struct ctlr_info *h, u8 *lunaddrbytes,
+				struct ext_report_lun_entry *rle)
+{
+	u8 device_flags;
+	u8 device_type;
+
+	if (!MASKED_DEVICE(lunaddrbytes))
+		return false;
+
+	device_flags = rle->device_flags;
+	device_type = rle->device_type;
+
+	if (device_flags & RPL_DEV_FLAG_NON_DISK) {
+		if (device_type == BMIC_DEVICE_TYPE_ENCLOSURE)
+			return false;
+		return true;
+	}
+
+	if (!(device_flags & RPL_DEV_FLAG_UNCONFIG_DISK_REPORTING_SUPPORTED))
+		return false;
+
+	if (device_flags & RPL_DEV_FLAG_UNCONFIG_DISK)
+		return false;
+
+	/*
+	 * Spares may be spun down, we do not want to
+	 * do an Inquiry to a RAID set spare drive as
+	 * that would have them spun up, that is a
+	 * performance hit because I/O to the RAID device
+	 * stops while the spin up occurs which can take
+	 * over 50 seconds.
+	 */
+	if (hpsa_is_disk_spare(h, lunaddrbytes))
+		return true;
+
+	return false;
+}
 
 static void hpsa_update_scsi_devices(struct ctlr_info *h)
 {
@@ -4023,6 +4087,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 		u8 *lunaddrbytes, is_OBDR = 0;
 		int rc = 0;
 		int phys_dev_index = i - (raid_ctlr_position == 0);
+		bool skip_device = false;
 
 		physical_device = i < nphysicals + (raid_ctlr_position == 0);
 
@@ -4030,10 +4095,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 		lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
 			i, nphysicals, nlogicals, physdev_list, logdev_list);
 
-		/* skip masked non-disk devices */
-		if (MASKED_DEVICE(lunaddrbytes) && physical_device &&
-			(physdev_list->LUN[phys_dev_index].device_flags & 0x01))
-			continue;
+		/*
+		 * Skip over some devices such as a spare.
+		 */
+		if (!tmpdevice->external && physical_device) {
+			skip_device = hpsa_skip_device(h, lunaddrbytes,
+					&physdev_list->LUN[phys_dev_index]);
+			if (skip_device)
+				continue;
+		}
 
 		/* Get device type, vendor, model, device id */
 		rc = hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 4.4 0/2] Backports for stable 4.4
  2016-10-18  7:21 [PATCH 4.4 0/2] Backports for stable 4.4 Juerg Haefliger
  2016-10-18  7:26 ` [PATCH 4.4 1/2] sd: Fix rw_max for devices that report an optimal xfer size Juerg Haefliger
  2016-10-18  7:27 ` [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals Juerg Haefliger
@ 2016-10-26  9:20 ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2016-10-26  9:20 UTC (permalink / raw)
  To: Juerg Haefliger; +Cc: stable

On Tue, Oct 18, 2016 at 09:21:27AM +0200, Juerg Haefliger wrote:
> The first commit fixes an issue with spare RAID drives being woken up
> and causing IO delays.
> 
> The second commit was meant to be included in 4.4 but never landed.

All now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals
  2016-10-18  7:27 ` [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals Juerg Haefliger
@ 2016-10-31 19:05   ` Jiri Slaby
  2016-10-31 19:46     ` Don Brace
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2016-10-31 19:05 UTC (permalink / raw)
  To: Juerg Haefliger, stable, gregkh; +Cc: don.brace

On 10/18/2016, 09:27 AM, Juerg Haefliger wrote:
> From: Don Brace <don.brace@microsemi.com>
> 
> commit 64ce60cab24603ac0fcd59c9fbc3be78f4c4d229 upstream.
> 
> The SA controller spins down RAID drive spares.
> 
> A REGNEWD event causes an inquiry to be sent to all physical
> drives. This causes the SA controller to spin up the spare.
> 
> The controller suspends all I/O to a logical volume until
> the spare is spun up. The spin-up can take over 50 seconds.
> 
> This can result in one or both of the following:
>  - SML sends down aborts and resets to the logical volume
>    and can cause the logical volume to be off-lined.
>  - a negative impact on the logical volume's I/O performance
>    each time a REGNEWD is triggered.
...
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -3930,6 +3930,70 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h,
...
> +static bool hpsa_skip_device(struct ctlr_info *h, u8 *lunaddrbytes,
> +				struct ext_report_lun_entry *rle)
> +{
> +	u8 device_flags;
> +	u8 device_type;
> +
> +	if (!MASKED_DEVICE(lunaddrbytes))
> +		return false;
> +
> +	device_flags = rle->device_flags;
> +	device_type = rle->device_type;
> +
> +	if (device_flags & RPL_DEV_FLAG_NON_DISK) {
> +		if (device_type == BMIC_DEVICE_TYPE_ENCLOSURE)
> +			return false;

Is this correct in 4.4 indeed, given we do not test 6 (TYPE_ENCLOSURE)
in the code below?

> @@ -4030,10 +4095,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
>  		lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
>  			i, nphysicals, nlogicals, physdev_list, logdev_list);
>  
> -		/* skip masked non-disk devices */
> -		if (MASKED_DEVICE(lunaddrbytes) && physical_device &&
> -			(physdev_list->LUN[phys_dev_index].device_flags & 0x01))
> -			continue;

That was added only later (4.5) by:
commit cca8f13b4fdaf3583e103ae7f96fda948839b265
Author: Don Brace <don.brace@pmcs.com>
Date:   Tue Dec 22 10:36:48 2015 -0600

    hpsa: Add box and bay information for enclosure devices

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals
  2016-10-31 19:05   ` Jiri Slaby
@ 2016-10-31 19:46     ` Don Brace
  0 siblings, 0 replies; 6+ messages in thread
From: Don Brace @ 2016-10-31 19:46 UTC (permalink / raw)
  To: Jiri Slaby, Juerg Haefliger, stable, gregkh

> -----Original Message-----
> From: Jiri Slaby [mailto:jslaby@suse.cz]
> Sent: Monday, October 31, 2016 2:06 PM
> To: Juerg Haefliger; stable@vger.kernel.org; gregkh@linuxfoundation.org
> Cc: Don Brace
> Subject: Re: [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals
> 
> EXTERNAL EMAIL
> 
> 
> On 10/18/2016, 09:27 AM, Juerg Haefliger wrote:
> > From: Don Brace <don.brace@microsemi.com>
> >
> > commit 64ce60cab24603ac0fcd59c9fbc3be78f4c4d229 upstream.
> >
> > The SA controller spins down RAID drive spares.
> >
> > A REGNEWD event causes an inquiry to be sent to all physical
> > drives. This causes the SA controller to spin up the spare.
> >
> > The controller suspends all I/O to a logical volume until
> > the spare is spun up. The spin-up can take over 50 seconds.
> >
> > This can result in one or both of the following:
> >  - SML sends down aborts and resets to the logical volume
> >    and can cause the logical volume to be off-lined.
> >  - a negative impact on the logical volume's I/O performance
> >    each time a REGNEWD is triggered.
> ...
> > --- a/drivers/scsi/hpsa.c
> > +++ b/drivers/scsi/hpsa.c
> > @@ -3930,6 +3930,70 @@ static int hpsa_set_local_logical_count(struct
> ctlr_info *h,
> ...
> > +static bool hpsa_skip_device(struct ctlr_info *h, u8 *lunaddrbytes,
> > +                             struct ext_report_lun_entry *rle)
> > +{
> > +     u8 device_flags;
> > +     u8 device_type;
> > +
> > +     if (!MASKED_DEVICE(lunaddrbytes))
> > +             return false;
> > +
> > +     device_flags = rle->device_flags;
> > +     device_type = rle->device_type;
> > +
> > +     if (device_flags & RPL_DEV_FLAG_NON_DISK) {
> > +             if (device_type == BMIC_DEVICE_TYPE_ENCLOSURE)
> > +                     return false;
> 
> Is this correct in 4.4 indeed, given we do not test 6 (TYPE_ENCLOSURE)
> in the code below?
> 
> > @@ -4030,10 +4095,15 @@ static void hpsa_update_scsi_devices(struct
> ctlr_info *h)
> >               lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
> >                       i, nphysicals, nlogicals, physdev_list, logdev_list);
> >
> > -             /* skip masked non-disk devices */
> > -             if (MASKED_DEVICE(lunaddrbytes) && physical_device &&
> > -                     (physdev_list->LUN[phys_dev_index].device_flags & 0x01))
> > -                     continue;
> 
> That was added only later (4.5) by:
> commit cca8f13b4fdaf3583e103ae7f96fda948839b265
> Author: Don Brace <don.brace@pmcs.com>
> Date:   Tue Dec 22 10:36:48 2015 -0600
> 
>     hpsa: Add box and bay information for enclosure devices
> 
> thanks,
> --
> js
> suse labs

The code would work, however it is not before the Inquiry and we updated
this code to avoid Inquiries to spares.

Thanks,
Don Brace

ESC - Smart Storage
Microsemi Corporation


 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-01  0:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18  7:21 [PATCH 4.4 0/2] Backports for stable 4.4 Juerg Haefliger
2016-10-18  7:26 ` [PATCH 4.4 1/2] sd: Fix rw_max for devices that report an optimal xfer size Juerg Haefliger
2016-10-18  7:27 ` [PATCH 4.4 2/2] hpsa: correct skipping masked peripherals Juerg Haefliger
2016-10-31 19:05   ` Jiri Slaby
2016-10-31 19:46     ` Don Brace
2016-10-26  9:20 ` [PATCH 4.4 0/2] Backports for stable 4.4 Greg KH

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.