Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Feb 2012 14:09:11 +0530
From:      "Desai, Kashyap" <Kashyap.Desai@lsi.com>
To:        Jason Wolfe <nitroboost@gmail.com>
Cc:        "freebsd-scsi@freebsd.org" <freebsd-scsi@freebsd.org>, "McConnell, Stephen" <Stephen.McConnell@lsi.com>
Subject:   RE: LSI2008 controller clobbers first disk with new LSI mps driver
Message-ID:  <B2FD678A64EAAD45B089B123FDFC3ED72B96D347BB@inbmail01.lsi.com>
In-Reply-To: <CAAAm0r3oRTcfipyVcp9nE1CL3dcK7cft8AUSf%2BfGYVK90b2A0w@mail.gmail.com>
References:  <CAAAm0r2NFhF=eh2bOPMnVN8E6e2o0KfaST0N-M_gWoJHpFOLmQ@mail.gmail.com> <CAAAm0r37H0Pf_HvFTqo%2B1RSCV%2BBkzD5EcXj5M40H9xGREr%2Bfow@mail.gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D344CA@inbmail01.lsi.com> <CAAAm0r3MVHZixAKDF=ChD977PbNUC8dyiBFB=NzC30S8FeZ3Nw@mail.gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D344F2@inbmail01.lsi.com> <CAAAm0r02bXNve6Do5C1m1RyzLhWA9xx97KKMeLhcHC66U2SF4g@mail.gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D34500@inbmail01.lsi.com> <CAFPOs6pwb44oNabH5vabDPJyFutMKa5mhgvHY=HkQVpV20YiYw@mail.gmail.com> <CAAAm0r1pWN-F=madGdk7N%2BoRuZmSD5_MAYwLh6By126L0CTGuw@mail.gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D34558@inbmail01.lsi.com> <CAAAm0r1x15_ho2MD0tX7Y7A6mnU2N6zihNOz_Qz=jpsyBkDCWQ@mail.gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D3455B@inbmail01.lsi.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D34626@inbmail01.lsi.com> <CAAAm0r3_S2jTG=Te4UhLqHPqiXq7_aAOHNp=W3jb4KLJx9PTRg@mail.gmail.com> <B2FD678A64EAAD45B089B123FDFC3ED72B96D34748@inbmail01.lsi.com> <CAAAm0r3oRTcfipyVcp9nE1CL3dcK7cft8AUSf%2BfGYVK90b2A0w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Here is a possible root cause of this issue.

Enclosure which you are using in your setup (might be) not configured properly.

You have Enclosure with 12 Slots + 1 SES Device.
See below detail from the log.

	EventDataLength: 5
	AckRequired: 0
	Event: SasEnclDeviceStatusChange (0x1d)
	EventContext: 0x0
	EnclosureHandle: 0x2
	ReasonCode: Added
	PhysicalPort: 0
	NumSlots: 13
	StartSlot: 0
	PhyBits: 0xff

StartSlot is 0 in this case. 
Correct behavior should be each device on your enclosure must have different slot number starting from 0 till 12. 
I have doubt that SES device has not configured well and it is using slot-0 as default. This can create issue for actual device which is connected to slot-0.
So In your setup you will have slot-0 till slot-11 assigned for actual Phys of your enclosures and again slot-0 is assigned for SES device instead of Slot-12.

To confirm my doubt: please provide me debug dmesg log using attached patch.

~ Kashyap

> -----Original Message-----
> From: Jason Wolfe [mailto:nitroboost@gmail.com]
> Sent: Wednesday, February 22, 2012 2:06 AM
> To: Desai, Kashyap
> Cc: freebsd-scsi@freebsd.org; McConnell, Stephen
> Subject: Re: LSI2008 controller clobbers first disk with new LSI mps
> driver
> 
> On Tue, Feb 21, 2012 at 10:51 AM, Desai, Kashyap <Kashyap.Desai@lsi.com>
> wrote:
> > Jason,
> >
> > I am looking at your logs and trying to correlate with code.
> >
> > Meanwhile can you try to reduce 4 Drives from you setup and repeat the
> same test ?
> > BTW, Do you have access to "lsiutil" ?
> >
> > ~ Kashyap
> 
> Kashyap,
> 
> I don't have physical access to the server, it's in one of our remote
> locations.  If it comes down to it, I could have drives removed, but
> it's $$.  Let me know if you think it will require that.  I've not
> seen lsiutil for FreeBSD and I was under the impression it was closed
> source.  Maybe you can point me in the direction if there is a way I
> can grab it?
> 
> Jason

[-- Attachment #2 --]
Index: mps_mapping.c
===================================================================
--- mps_mapping.c	(revision 231936)
+++ mps_mapping.c	(working copy)
@@ -943,6 +943,9 @@
 		phy_change->device_info =
 		    le32toh(sas_device_pg0.DeviceInfo);
 
+		printf("LSI Debug %s %d sas addr %jx slot %d \n", __func__, __LINE__,
+					sas_address, phy_change->slot);
+
 		if ((ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_MASK_MAPPING_MODE) ==
 		    MPI2_IOCPAGE8_FLAGS_ENCLOSURE_SLOT_MAPPING) {
 			enc_idx = _mapping_get_enc_idx_from_handle(sc,
@@ -970,10 +973,14 @@
 			if (!topo_change->exp_handle) {
 				map_idx	= sc->num_rsvd_entries;
 				et_entry->start_index = map_idx;
+				printf("LSI Debug %s %d %d %d %d\n", __func__, __LINE__,
+					et_entry->start_index, et_entry->num_slots, et_entry->phy_bits);
 			} else {
 				map_idx = _mapping_find_enc_map_space(sc,
 				    et_entry);
 				et_entry->start_index = map_idx;
+				printf("LSI Debug %s %d %d %d %d\n", __func__, __LINE__,
+					et_entry->start_index, et_entry->num_slots, et_entry->phy_bits);
 				if (et_entry->start_index ==
 				    MPS_MAPTABLE_BAD_IDX) {
 					phy_change->is_processed = 1;
@@ -1458,7 +1465,35 @@
 	free(sc->dpm_pg0, M_MPT2);
 }
 
+static void dump_all_fw_dpm_pg0(struct mps_softc *sc) 
+{
+		Mpi2DriverMap0Entry_t *dpm_entry;
+		u16 entry_num;
+		// Skip the header
+		dpm_entry = (Mpi2DriverMap0Entry_t *) ((uint8_t *) sc->dpm_pg0 +
+	    sizeof(MPI2_CONFIG_EXTENDED_PAGE_HEADER));
+		printf("Dump Complete DPM FW Pages...........!\n");
+		printf("#############################################\n");
+		printf("(Entry)  physical_id \t : Mapping Info:\t DeviceIndex:\t PhysicalBitsMapping\n");
+		for (entry_num = 0; entry_num < sc->max_dpm_entries; entry_num++, 
+	    		dpm_entry++) {
+				printf(" (%x)   %08x", entry_num, dpm_entry->PhysicalIdentifier.High);
+				printf(" %08x \t", dpm_entry->PhysicalIdentifier.Low);
+				printf(" %08x \t", dpm_entry->MappingInformation);
+				printf(" %08x \t", dpm_entry->DeviceIndex);
+				printf(" %08x \n", dpm_entry->PhysicalBitsMapping);
+		}
+		printf("#############################################\n");
+}	
 
+static void dump_fw_dpm_pg0(Mpi2DriverMap0Entry_t *dpm_entry)
+{
+		printf("       %08x", dpm_entry->PhysicalIdentifier.High);
+		printf(" %08x \t", dpm_entry->PhysicalIdentifier.Low);
+		printf(" %08x \t", dpm_entry->MappingInformation);
+		printf(" %08x \t", dpm_entry->DeviceIndex);
+		printf(" %08x \n", dpm_entry->PhysicalBitsMapping);
+}	
 static void
 _mapping_process_dpm_pg0(struct mps_softc *sc)
 {
@@ -1472,6 +1507,9 @@
 	struct enc_mapping_table *et_entry;
 	u64 physical_id;
 	u32 phy_bits = 0;
+	
+	// Dump All dpm entry to debug
+	dump_all_fw_dpm_pg0(sc);	
 
 	if (sc->ir_firmware)
 		_mapping_get_ir_maprange(sc, &start_idx, &end_idx);
@@ -1487,6 +1525,8 @@
 			sc->dpm_entry_used[entry_num] = 0;
 			continue;
 		}
+		// Dump dpm entry to debug
+		dump_fw_dpm_pg0(dpm_entry);	
 		sc->dpm_entry_used[entry_num] = 1;
 		dpm_entry->MappingInformation = le16toh(dpm_entry->
 		    MappingInformation);
@@ -1834,6 +1874,31 @@
 }
 
 /**
+ * mps_dump_dev_mapping_table - Dump Device mpapping table
+ * @sc: per adapter object
+ *
+ */
+void mps_dump_dev_mapping_table(struct mps_softc *sc)
+{
+	u32 map_idx;
+	struct dev_mapping_table *mt_entry;
+
+	printf("Index \t physical_id \t : phy_bits:\t dpm_entry_num:\t  dev_handle:\t   id:\t    missing_count\n");
+	for (map_idx = 0; map_idx < sc->max_devices; map_idx++) {
+		mt_entry = &sc->mapping_table[map_idx];
+		if(mt_entry->physical_id == 0)
+			continue;
+
+		printf("(%x) %016lx:\t", map_idx, mt_entry->physical_id);
+		printf(" %08x:\t", mt_entry->phy_bits);
+		printf(" %08x:\t", mt_entry->dpm_entry_num);
+		printf(" %08x:\t", mt_entry->dev_handle);
+		printf(" %08x:\t", mt_entry->id);
+		printf(" %08x:\n", mt_entry->missing_count);
+	}
+
+}
+/**
  * mps_mapping_get_sas_id_from_handle - find a target id in mapping table using
  * only the dev handle.  This is just a wrapper function for the local function
  * _mapping_get_mt_idx_from_handle.
@@ -1907,6 +1972,8 @@
 	u32 saved_phy_bits;
 	uint64_t temp64_var;
 
+	printf("LSI Debug %s %d mapping %d \n", __func__, __LINE__,
+					ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_MASK_MAPPING_MODE);
 	if ((ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_MASK_MAPPING_MODE) !=
 	    MPI2_IOCPAGE8_FLAGS_ENCLOSURE_SLOT_MAPPING)
 		goto out;
@@ -1984,6 +2051,8 @@
 			et_entry->num_slots = le16toh(event_data->NumSlots);
 			et_entry->start_slot = le16toh(event_data->StartSlot);
 			et_entry->phy_bits = le32toh(event_data->PhyBits);
+			printf("LSI Debug %s %d %d %d %d\n", __func__, __LINE__,
+					et_entry->start_index, et_entry->num_slots, et_entry->phy_bits);
 		}
 		et_entry->init_complete = 1;
 	} else if (event_data->ReasonCode ==

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B2FD678A64EAAD45B089B123FDFC3ED72B96D347BB>