◆◆◆ 2017第十五届中国(广州)国际汽车零部件及用品展览会 [GHC8/C-m] 20803

2016-11-16 Thread 基坑施工设备
litao918...@163.com

中国国际汽车零部件博览会
China International Auto Parts Expo


中华人民共和国商务部引导支持展会
国家级国际性汽车配件用品展贸平台
 
【中文名称】 2017第十五届中国(广州)国际汽车零部件及用品展览会
【英文名称】 The 15th China (Guangzhou) International Auto Parts Expo,2017 (CAPE 2017)
 
【展会日期】 2017年06月02—04日
【展会场馆】 广州琶洲保利世贸博览馆
 
【展会简介】 
本届CAPE预计展会面积67000平方米,标准展位3000多个,参观观众65330多人;其中,专业买家3多人,终端消费者25000多人,国外采购商7551多人。
【参展情况】 目前仅剩少量展位,请即刻登陆官网报名。机不可失!
 
【参展联系】 
官网:http://www.CAPE-china.com 
QQ:12809395#qq.com(邮箱)
电话:4000-680-860转8144; 010—8699-7155、6923-6944 
手机:139-1031-8144; 
联系人:王超 (先生)

 
  
  
【公众平台】
  
微信: 参展消息 (ID:CanZhanXiaoXi)—— 品牌扩张的平台 市场开拓的桥梁
微信: 展商之家 (ID:ZhanShangZhiJia)—— 为展商提供最佳营地 为阁下营造参展价值
  
  
---
百万群发系统|为您发送|如不希望再收到此行业资讯|请回复“TD+CAPE 2017”至邮箱1055800...@qq.com


Re: [PATCH] 53c700: fix memory leak of dma non-cosistent memory

2016-11-16 Thread James Bottomley
On Mon, 2016-11-14 at 15:07 +0800, Li Qiang wrote:
> From: Li Qiang 
> 
> In NCR_700_detect function, if an error occurs it will return
> NULL without freeing the dma non-cosistent memory once allocated.
> This patch avoid this.
> 
> Signed-off-by: Li Qiang 

There's not a lot of point doing this, since the memory leak is so tiny
and the failures would be instantly noticeable.  However:

> ---
>  drivers/scsi/53c700.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
> index 95e32a4..d5a2ba3 100644
> --- a/drivers/scsi/53c700.c
> +++ b/drivers/scsi/53c700.c
> @@ -332,8 +332,10 @@ struct Scsi_Host *
>   tpnt->proc_name = "53c700";
>  
>   host = scsi_host_alloc(tpnt, 4);
> - if (!host)
> + if (!host) {
> + dma_free_noncoherent(hostdata->dev, TOTAL_MEM_SIZE,
> memory, pScript);
>   return NULL;
> + }

This you could do.

>   memset(hostdata->slots, 0, sizeof(struct
> NCR_700_command_slot)
>  * NCR_700_COMMAND_SLOTS_PER_HOST);
>   for (j = 0; j < NCR_700_COMMAND_SLOTS_PER_HOST; j++) {
> @@ -394,6 +396,7 @@ struct Scsi_Host *
>  
>   if (scsi_add_host(host, dev)) {
>   dev_printk(KERN_ERR, dev, "53c700: scsi_add_host
> failed\n");
> + dma_free_noncoherent(hostdata->dev, TOTAL_MEM_SIZE,
> memory, pScript);
>   scsi_host_put(host);
>   return NULL;
>   }

This I'm not sure about; I'd have to dig more deeply into how the
driver works.  If the scripts engine is already started, you can't just
free the memory it's running from without actually stopping it,
otherwise nasty things may happen if something else reuses the memory. 
 I have a vague feeling that this driver is activation driven rather
than mailbox driven, so it might be OK, but it needs checking.

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: [PATCH] mvsas: fix command_active typo

2016-11-16 Thread Martin K. Petersen
> "Arnd" == Arnd Bergmann  writes:

Arnd> gcc-7 notices that the condition in mvs_94xx_command_active looks
Arnd> suspicious:

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] scsi: dmx3191d: use module_pci_driver

2016-11-16 Thread Martin K. Petersen
> "Geliang" == Geliang Tang  writes:

Geliang> Use module_pci_driver() helper to simplify the code.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] fnic: Correcting rport check location in fnic_queuecommand_lck

2016-11-16 Thread Martin K. Petersen
> "Satish" == Satish Kharat  writes:

Applied to 4.10/scsi-queue. Please add a more verbose patch description
next time.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] 53c700: fix memory leak of dma non-cosistent memory

2016-11-16 Thread Martin K. Petersen
> "Li" == Li Qiang  writes:

Li> In NCR_700_detect function, if an error occurs it will return NULL
Li> without freeing the dma non-cosistent memory once allocated.  This
Li> patch avoid this.

James: Please review!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] fnic: remove a pointless test

2016-11-16 Thread Martin K. Petersen

Satish, Sesidhar,

Please review Tomas' patch:

https://patchwork.kernel.org/patch/9407637/

Thank you!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH v3] ufs: introduce UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR quirk

2016-11-16 Thread Martin K. Petersen
> "Kiwoong" == Kiwoong Kim  writes:

Hi Kiwoong,

Kiwoong> Some UFS host controllers may clear a transfer request slot by
Kiwoong> setting an associated bit in UTRLCLR/UTMRLCLR to 1, not 0.
Kiwoong> That's opposite to what UFS spec describes.

These don't apply cleanly to 4.10/scsi-queue. Please send a v4, ideally
as a series.

Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] scsi: ufs: introduce a new ufshcd_statea UFSHCD_STATE_EH_SCHEDULED

2016-11-16 Thread Martin K. Petersen
> "Zang" == Zang Leigang  writes:

Zang> Add a new ufshcd_state, indicats that an err handler may get to
Zang> run immediately. Use UFSHCD_STATE_ERROR here looks not literaly
Zang> correct.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH 1/1] [fnic, snic] Updating maintainers list for Cisco FNI and SNIC drivers

2016-11-16 Thread Martin K. Petersen
> "Satish" == Satish Kharat  writes:

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH V2] hpsa: correct logical resets

2016-11-16 Thread Martin K. Petersen
> "Don" == Don Brace  writes:

Don> - driver was not calling done in some cases which causes
Don>   the volume to be offlined.
Don> - avoid doing rescan during a reset.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] megaraid-sas: request irqs later

2016-11-16 Thread Martin K. Petersen
> "Tomas" == Tomas Henzl  writes:

Tomas> It is not good when an irq arrives before driver structures are
Tomas> allocated.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: [PATCH] scsi: dmx3191d: use module_pci_driver

2016-11-16 Thread Finn Thain

On Wed, 16 Nov 2016, Geliang Tang wrote:

> Use module_pci_driver() helper to simplify the code.
> 
> Signed-off-by: Geliang Tang 

Acked-by: Finn Thain 

> ---
>  drivers/scsi/dmx3191d.c | 13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
> index 3aa4657..6af3394 100644
> --- a/drivers/scsi/dmx3191d.c
> +++ b/drivers/scsi/dmx3191d.c
> @@ -153,18 +153,7 @@ static struct pci_driver dmx3191d_pci_driver = {
>   .remove = dmx3191d_remove_one,
>  };
>  
> -static int __init dmx3191d_init(void)
> -{
> - return pci_register_driver(&dmx3191d_pci_driver);
> -}
> -
> -static void __exit dmx3191d_exit(void)
> -{
> - pci_unregister_driver(&dmx3191d_pci_driver);
> -}
> -
> -module_init(dmx3191d_init);
> -module_exit(dmx3191d_exit);
> +module_pci_driver(dmx3191d_pci_driver);
>  
>  MODULE_AUTHOR("Massimo Piccioni ");
>  MODULE_DESCRIPTION("Domex DMX3191D SCSI driver");
> 
--
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: Ordering problems with 3ware controller

2016-11-16 Thread Donald Buczek


On 10.11.2016 14:59, Martin K. Petersen wrote:

"Paul" == Paul Menzel  writes:

Paul,


Linux does not provide device discovery ordering guarantees. You need
to fix your scripts to use UUIDs, filesystem labels, or DM devices to
get stable naming.

Paul> Indeed. But it worked for several years, so that *something* must
Paul> have changed that the ordering of the result of `getdents64` is
Paul> different now.

Could be changes in the PCI or platform code that causes things to be
enumerated differently. Whatever it is, it has nothing to do with the
3ware drivers themselves since they have been dormant for a long time.



Right. We further tracked it down. In fact its not a matter of driver 
initialization order but of the way sysfs/kernfs hashes its object names 
and thereby defines the order of names returned by getdents64 calls. In 
fs/kernfs/dir.h the names are inserted into a red-black tree ordered by 
the hashes over their names (and possibly namespace pointer, which in 
our case is zero).


I've walked the rbtrees of the kernfs_node structs from 
/sys/class/scsi_host showing their addresses, the hash values and the 
names in a 4.4.27 system:


root:cu:/home/buczek/autofs/# ./peek-3w

88046d847640 : 11bf1ddd : host0
88046c56d3e8 : 11bf1e8d : host1
88046c571c58 : 11bf1f3d : host2
88046c572550 : 11bf1fed : host3
88046c577dc0 : 11bf209d : host4
88046a4bbaf0 : 11bf214d : host5

As can be seen, in 4.4 the hash algorithm happened to produce increasing 
hash values for names like "host0","host1","host2",... In 4.8.6 the hash 
values seem to be more random:


root:gynaekophobie:/home/buczek/autofs/# ./peek-3w

88041df9a7f8 : 074af64b : host0
88081db40528 : 1009cd9b : host9
88041d3fba50 : 1c512bfb : host7
88181d19c000 : 28988a5b : host5
88041df5a780 : 34dfe8bb : host3
88041d3f5e10 : 4127471b : host1
88041ccbd258 : 562d7ccb : host8
88201cd5f960 : 6274db2b : host6
88141e2d0ca8 : 6ebc398b : host4
88041df599d8 : 7b0397eb : host2

The relevant commit is 703b5fa  which includes

 static inline unsigned long end_name_hash(unsigned long hash)
 {
-   return (unsigned int)hash;
+   return __hash_32((unsigned int)hash);
 }

__hash_32 is a multiplication by 0x61C88647 ( hash.h )

And this exactly is the difference between the hash value of "host0" on 
the 4.4 and the 4.8 system:


  DB<2> x sprintf '%x',0x11bf1ddd*0x61C88647
0  '6c750ef074af64b'

The bug, of course, is in the userspace tool tw_cli which wrongly 
assumes that the names would be returned in the "right" order by getdents.


As a dirty workaround, I've created a new wrapper, which uses ptrace to 
pause the program on return from SYS_getdents64 and sorts the values 
returned from the system call in the memory of the target process.


I append the source of the wrapper.
--

Donald Buczek
buc...@molgen.mpg.de
Tel: +49 30 8413 1433

#define _GNU_SOURCE /* See feature_test_macros(7) */
#include 
#include/* For SYS_xxx definitions */
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

typedef uint64_t u64;
typedef int64_t s64;

/* from include/linux/dirent.h : */

struct linux_dirent64 {
u64 d_ino;
s64 d_off;
unsigned short  d_reclen;
unsigned char   d_type;
chard_name[0];
};

void die(char *fmt,...) {
	va_list ap;
	va_start(ap,fmt);
	vfprintf(stderr,fmt,ap);
	exit(1);
}

void die_regerror(int status,regex_t *re) {
	char msg[80];
	int s;
	s=regerror(status,re,msg,sizeof(msg));
	die("regex: %s\n",msg);
}

int hostnum(char *hostname) {
	static regex_t *re=NULL;
	int status;
	regmatch_t match[2];

	if (!re) {
		re=malloc(sizeof(*re));
		if (!re) die("");
		status=regcomp(re,"^host([0-9]+)$",REG_EXTENDED);
		if (status) die_regerror(status,re);
	}

	status=regexec(re,hostname,sizeof(match)/sizeof(*match),match,0);
	if (status==0) {
		char c=hostname[match[1].rm_eo];
		match[1].rm_eo='\0';
		int num=atoi(&hostname[match[1].rm_so]);
		match[1].rm_eo=c;
		return(num);
	} else if (status==REG_NOMATCH) {
		return(-1);
	} else {
		die_regerror(status,re);
	}
}

struct sortentry {
	struct linux_dirent64 *dirent;
	int hostnum;
};

int compare_sortentry(const void *vp1,const void *vp2) {
	struct sortentry *p1=(struct sortentry *)vp1;
	struct sortentry *p2=(struct sortentry *)vp2;

	if (p1->hostnum!=-1 && p2->hostnum!=-1) {
		return p1->hostnumhostnum ? -1 : p1->hostnum>p2->hostnum ? 1 : 0;
	}
	return strcmp(p1->dirent->d_name,p2->dirent->d_name);
}

void fix_memory(pid_t pid,size_t count,void *dirp) {

	char *memfilename;
	int fd;

	char *dirents_unsorted,*dirents_sorted;
	struct sortentry *sort_array;
	struct sortentry *sort_entry;

	size_t s;

	int entry_count;
	int bpos;
	int i;

	struct linux_dirent64 *d;

	if (count==0) return;

	if (asprintf(&memfilename,"/proc/%d/mem",pid)==-1) die("%m\n");

	fd=open(memfilename,O_RDWR);
	if (

Re: [PATCH v3] ufs: add a variety of definitions decribed in UFS spec

2016-11-16 Thread Subhash Jadavani

On 2016-11-15 21:14, Kiwoong Kim wrote:

These things are defined to be used by some UFS Host controllers.
And a new file for some declarations of mphy standard is added

Signed-off-by: Kiwoong Kim 
---
V3: add new macros of all bits of UECDL



You should keep the previous version history intact as well. Please do 
that in future. Other than that, this patch looks good to me.


Reviewed-by: Subhash Jadavani 


---
 drivers/scsi/ufs/mphy.h   | 38 ++
 drivers/scsi/ufs/ufshci.h | 28 +---
 drivers/scsi/ufs/unipro.h | 26 ++
 3 files changed, 89 insertions(+), 3 deletions(-)
 create mode 100644 drivers/scsi/ufs/mphy.h

diff --git a/drivers/scsi/ufs/mphy.h b/drivers/scsi/ufs/mphy.h
new file mode 100644
index 000..c431f49
--- /dev/null
+++ b/drivers/scsi/ufs/mphy.h
@@ -0,0 +1,38 @@
+/*
+ * drivers/scsi/ufs/mphy.h
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or 
modify
+ * it under the terms of the GNU General Public License as published 
by

+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _MPHY_H_
+#define _MPHY_H_
+
+#define TX_HIBERN8TIME_CAP 0x0f
+#define TX_MIN_ACTIVATE_TIME   0x33
+
+#define RX_HS_G1_SYNC_LEN_CAP  0x8b
+#define RX_HS_G1_PREP_LEN_CAP  0x8c
+#define RX_HS_G2_SYNC_LEN_CAP  0x94
+#define RX_HS_G3_SYNC_LEN_CAP  0x95
+#define RX_HS_G2_PREP_LEN_CAP  0x96
+#define RX_HS_G3_PREP_LEN_CAP  0x97
+ #define SYNC_RANGE_FINE   (0 << 6)
+ #define SYNC_RANGE_COARSE (1 << 6)
+ #define SYNC_LEN(x)   ((x) & 0x3f)
+ #define PREP_LEN(x)   ((x) & 0xf)
+#define RX_ADV_GRANULARITY_CAP 0x98
+ #define RX_ADV_GRAN_STEP(x)   x) & 0x3) << 1) | 0x1)
+#define TX_ADV_GRANULARITY_CAP 0x10
+ #define TX_ADV_GRAN_STEP(x)   x) & 0x3) << 1) | 0x1)
+#define RX_MIN_ACTIVATETIME_CAP0x8f
+#define RX_HIBERN8TIME_CAP 0x92
+#define RX_ADV_HIBERN8TIME_CAP 0x99
+#define RX_ADV_MIN_ACTIVATETIME_CAP0x9a
+
+#endif /* _MPHY_H_ */
+
diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
index 9599741..799cb26 100644
--- a/drivers/scsi/ufs/ufshci.h
+++ b/drivers/scsi/ufs/ufshci.h
@@ -170,17 +170,39 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR  UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT  0x2000
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED 0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED UFS_BIT(0)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT   UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_AFCx_REQUEST_TIMEOUT UFS_BIT(2)
+#define UIC_DATA_LINK_LAYER_ERROR_FCx_PROTECTION_TIMEOUT   UFS_BIT(3)
+#define UIC_DATA_LINK_LAYER_ERROR_CRC_ERRORUFS_BIT(4)
+#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OFUFS_BIT(5)
+#define UIC_DATA_LINK_LAYER_ERROR_MAX_FRAME_LENGTH_EXCEEDEDUFS_BIT(6)
+#define UIC_DATA_LINK_LAYER_ERROR_WRONG_SEQUENCE_NUMBER
UFS_BIT(7)
+#define UIC_DATA_LINK_LAYER_ERROR_AFC_FRAME_SYNTAX_ERROR   UFS_BIT(8)
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_FRAME_SYNTAX_ERROR   UFS_BIT(9)
+#define UIC_DATA_LINK_LAYER_ERROR_EOF_SYNTAX_ERROR UFS_BIT(10)
+#define UIC_DATA_LINK_LAYER_ERROR_FRAME_SYNTAX_ERROR   UFS_BIT(11)
+#define UIC_DATA_LINK_LAYER_ERROR_BAD_CTRL_SYMBOL_TYPE UFS_BIT(12)
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT  UFS_BIT(13)
+#define UIC_DATA_LINK_LAYER_ERROR_PA_ERROR_IND_RECEIVED
UFS_BIT(14)
+

 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERRORUFS_BIT(31)
 #define UIC_NETWORK_LAYER_ERROR_CODE_MASK  0x7
+#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPEBIT(0)
+#define UIC_NETWORK_BAD_DEVICEID_ENC   BIT(1)
+#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING  BIT(2)

 /* UECT - Host UIC Error Code Transport Layer 44h */
 #define UIC_TRANSPORT_LAYER_ERROR  UFS_BIT(31)
 #define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK0x7F
+#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE  BIT(0)
+#define UIC_TRANSPORT_UNKNOWN_CPORTID  BIT(1)
+#define UIC_TRANSPORT_NO_CONNECTION_RX BIT(2)
+#define UIC_TRANSPORT_BAD_TC   BIT(4)
+#define UIC_TRANSPORT_E2E_CREDIT_OVERFLOW  BIT(5)
+#define UIC_TRANSPORT_SAFETY_VALVE_DROPPINGBIT(6)

 /* UECDME - Host UIC Error Code DME 48h */
 #define UIC_DME_ERROR  UFS_BIT(31)
diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h
index eff8b56..490d867 100644
--- a/drivers/scsi/ufs/unipro.h
+++ b/drivers/scsi/ufs/unipro.h
@@ -127,6 +127,7 @@
 #define PA_PACPREQEOBTI

Re: [PATCH v3] ufs: introduce UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR quirk

2016-11-16 Thread Subhash Jadavani

On 2016-11-15 21:05, Kiwoong Kim wrote:

If UFS driver resets interrupt aggregation timer and counter
when there are some pended tasks, an IO competion interrupt
of any corresponing task may be issued.
That would casue a command timeout.

One thing you should mind to use interrupt aggreation
with this quirk is that the host controller should be
able to refresh interrupt aggreation counter or timer
in other way, such as doing it automatically when receiving
any response.



This was the comment on v2: "As Martin mentioned in other email, please 
separate this version history from commit text with line having "" 
before the start of version history."
So i would have expected the patch version to be still v2 and just add 
the version history separator added before version history. But you 
posted v3 and removed the version history altogether. As far as patch 
contents are concerned, it looks good to me hence i am adding by 
reviewed-by. But please make sure to keep the version history intact for 
fewer patches.


Reviewed-by: Subhash Jadavani 


Signed-off-by: Kiwoong Kim 
---
 drivers/scsi/ufs/ufshcd.c | 3 ++-
 drivers/scsi/ufs/ufshcd.h | 7 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 8aac98f..7b62d8b 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3713,7 +3713,8 @@ static void ufshcd_transfer_req_compl(struct 
ufs_hba *hba)
 	 * false interrupt if device completes another request after 
resetting

 * aggregation and before reading the DB.
 */
-   if (ufshcd_is_intr_aggr_allowed(hba))
+   if ((ufshcd_is_intr_aggr_allowed(hba))
+   && !(hba->quirks & UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR))
ufshcd_reset_intr_aggr(hba);

tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index dfa17ac..d6861ed 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -505,6 +505,13 @@ struct ufs_hba {
 */
#define UFSHCD_QUIRK_BROKEN_HCE UFS_BIT(9)

+   /*
+* This quirk is only not to reset interrupt aggregation logic
+* in ISR. The reset can make the host controller miss an event
+* of previously completed IO.
+*/
+   #define UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR   UFS_BIT(10)
+
unsigned int quirks;/* Deviations from standard UFSHCI spec. */

/* Device deviations from standard UFS device spec. */


--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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: [PATCH v3] ufs: introduce UFSHCD_QUIRK_BROKEN_HCE quirk

2016-11-16 Thread Subhash Jadavani

On 2016-11-15 21:04, Kiwoong Kim wrote:

Some UFS host controllers might not be able to
reset UIC by setting HCE to 1.
Those controllers should invoke 'DME reset' and 'DME enable'
in order instead.



This was the comment on v2: "As Martin mentioned in other email, please 
separate this version history from commit text with line having "" 
before the start of version history."
So i would have expected the patch version to be still v2 and just add 
the version history separator added before version history. But you 
posted v3 and removed the version history altogether. As far as patch 
contents are concerned, it looks good to me hence i am adding by 
reviewed-by. But please make sure to keep the version history intact for 
fewer patches.


Reviewed-by: Subhash Jadavani 



Signed-off-by: Kiwoong Kim 
---
 drivers/scsi/ufs/ufshcd.c | 44 
+++-

 drivers/scsi/ufs/ufshcd.h |  7 +++
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index c9cf011..8aac98f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2477,6 +2477,37 @@ static inline void
ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba)
usleep_range(min_sleep_time_us, min_sleep_time_us + 50);
 }

+static int ufshcd_dme_reset(struct ufs_hba *hba)
+{
+   struct uic_command uic_cmd = {0};
+   int ret;
+
+   uic_cmd.command = UIC_CMD_DME_RESET;
+   uic_cmd.argument1 = 0x1;
+
+   ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
+   if (ret)
+   dev_err(hba->dev,
+   "dme-reset: error code %d\n", ret);
+
+   return ret;
+}
+
+static int ufshcd_dme_enable(struct ufs_hba *hba)
+{
+   struct uic_command uic_cmd = {0};
+   int ret;
+
+   uic_cmd.command = UIC_CMD_DME_ENABLE;
+
+   ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
+   if (ret)
+   dev_err(hba->dev,
+   "dme-enable: error code %d\n", ret);
+
+   return ret;
+}
+
 /**
  * ufshcd_dme_set_attr - UIC command for DME_SET, DME_PEER_SET
  * @hba: per adapter instance
@@ -3084,6 +3115,7 @@ static inline void ufshcd_hba_stop(struct
ufs_hba *hba, bool can_sleep)
 static int ufshcd_hba_enable(struct ufs_hba *hba)
 {
int retry;
+   int ret = 0;

/*
 	 * msleep of 1 and 5 used in this function might result in 
msleep(20),

@@ -3100,6 +3132,9 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)

ufshcd_vops_hce_enable_notify(hba, PRE_CHANGE);

+   if (hba->quirks & UFSHCD_QUIRK_BROKEN_HCE)
+   goto use_dme;
+
/* start controller initialization sequence */
ufshcd_hba_start(hba);

@@ -3128,12 +3163,19 @@ static int ufshcd_hba_enable(struct ufs_hba 
*hba)

msleep(5);
}

+use_dme:
/* enable UIC related interrupts */
ufshcd_enable_intr(hba, UFSHCD_UIC_MASK);

+   if (hba->quirks & UFSHCD_QUIRK_BROKEN_HCE) {
+   ret = ufshcd_dme_reset(hba);
+   if (!ret)
+   ret = ufshcd_dme_enable(hba);
+   }
+
ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);

-   return 0;
+   return ret;
 }

 static int ufshcd_disable_tx_lcc(struct ufs_hba *hba, bool peer)
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 9838598..dfa17ac 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -498,6 +498,13 @@ struct ufs_hba {
 */
#define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLRUFS_BIT(8)

+   /*
+* This quirk needs to be enabled if the host contoller can't reset
+* UIC by setting HCE to 1. Those controllers should invoke
+* DME reset and DME enable in order.
+*/
+   #define UFSHCD_QUIRK_BROKEN_HCE UFS_BIT(9)
+
unsigned int quirks;/* Deviations from standard UFSHCI spec. */

/* Device deviations from standard UFS device spec. */


--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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: [PATCH v3] ufs: introduce UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR quirk

2016-11-16 Thread Subhash Jadavani

On 2016-11-15 21:03, Kiwoong Kim wrote:

Some UFS host controllers may clear a transfer request slot
by setting an associated bit in UTRLCLR/UTMRLCLR to 1, not 0.
That's opposite to what UFS spec describes.



This was the comment on v2: "As Martin mentioned in other email, please 
separate this version history from commit text with line having "" 
before the start of version history."
So i would have expected the patch version to be still v2 and just add 
the version history separator added before version history. But you 
posted v3 and removed the version history altogether. As far as patch 
contents are concerned, it looks good to me hence i am adding by 
reviewed-by. But please make sure to keep the version history intact for 
fewer patches.


Reviewed-by: Subhash Jadavani 



Signed-off-by: Kiwoong Kim 
---
 drivers/scsi/ufs/ufshcd.c | 28 ++--
 drivers/scsi/ufs/ufshcd.h |  7 +++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index d6e3112..c9cf011 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -392,7 +392,31 @@ static inline void ufshcd_put_tm_slot(struct
ufs_hba *hba, int slot)
  */
 static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos)
 {
-   ufshcd_writel(hba, ~(1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR);
+   u32 clear;
+
+   if (hba->quirks & UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR)
+   clear = (1 << pos);
+   else
+   clear = ~(1 << pos);
+
+   ufshcd_writel(hba, clear, REG_UTP_TRANSFER_REQ_LIST_CLEAR);
+}
+
+/**
+ * ufshcd_utmrl_clear - Clear a bit in UTRMLCLR register
+ * @hba: per adapter instance
+ * @pos: position of the bit to be cleared
+ */
+static inline void ufshcd_utmrl_clear(struct ufs_hba *hba, u32 pos)
+{
+   u32 clear;
+
+   if (hba->quirks & UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR)
+   clear = (1 << pos);
+   else
+   clear = ~(1 << pos);
+
+   ufshcd_writel(hba, clear, REG_UTP_TASK_REQ_LIST_CLEAR);
 }

 /**
@@ -4312,7 +4336,7 @@ static int ufshcd_clear_tm_cmd(struct ufs_hba
*hba, int tag)
goto out;

spin_lock_irqsave(hba->host->host_lock, flags);
-   ufshcd_writel(hba, ~(1 << tag), REG_UTP_TASK_REQ_LIST_CLEAR);
+   ufshcd_utmrl_clear(hba, tag);
spin_unlock_irqrestore(hba->host->host_lock, flags);

/* poll for max. 1 sec to clear door bell register by h/w */
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 7d9ff22..9838598 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -491,6 +491,13 @@ struct ufs_hba {
 */
#define UFSHCD_QUIRK_PRDT_BYTE_GRAN UFS_BIT(7)

+   /*
+* This quirk needs to be enabled if the host contoller has to set
+* the bit corresponding the slot to be cleared to 1, not 0 as
+* described in UFS spec.
+*/
+   #define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLRUFS_BIT(8)
+
unsigned int quirks;/* Deviations from standard UFSHCI spec. */

/* Device deviations from standard UFS device spec. */


--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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: [PATCH] scsi: ufs: introduce a new ufshcd_statea UFSHCD_STATE_EH_SCHEDULED

2016-11-16 Thread Subhash Jadavani

On 2016-11-15 19:29, Zang Leigang wrote:

Add a new ufshcd_state, indicats that an err handler may get to run
immediately. Use UFSHCD_STATE_ERROR here looks not literaly correct.

Signed-off-by: Zang Leigang 

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..59d4130 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -123,6 +123,7 @@ enum {
UFSHCD_STATE_RESET,
UFSHCD_STATE_ERROR,
UFSHCD_STATE_OPERATIONAL,
+   UFSHCD_STATE_EH_SCHEDULED,
 };

 /* UFSHCD error handling flags */
@@ -1410,6 +1411,7 @@ static int ufshcd_queuecommand(struct Scsi_Host
*host, struct scsi_cmnd *cmd)
switch (hba->ufshcd_state) {
case UFSHCD_STATE_OPERATIONAL:
break;
+   case UFSHCD_STATE_EH_SCHEDULED:
case UFSHCD_STATE_RESET:
err = SCSI_MLQUEUE_HOST_BUSY;
goto out_unlock;
@@ -4158,7 +4160,7 @@ static void ufshcd_check_errors(struct ufs_hba 
*hba)

/* block commands from scsi mid-layer */
scsi_block_requests(hba->host);

-   hba->ufshcd_state = UFSHCD_STATE_ERROR;
+   hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED;
schedule_work(&hba->eh_work);
}
}



LGTM.
Reviewed-by: Subhash Jadavani 


--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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: [PATCH] aacraid: switch to pci_alloc_irq_vectors

2016-11-16 Thread Raghava Aditya Renukunta


> -Original Message-
> From: Hannes Reinecke [mailto:h...@suse.de]
> Sent: Tuesday, November 15, 2016 11:37 PM
> To: Raghava Aditya Renukunta; Martin K. Petersen
> Cc: Christoph Hellwig; James Bottomley; linux-scsi@vger.kernel.org; Hannes
> Reinecke; dl-esc-Aacraid Linux Driver
> Subject: Re: [PATCH] aacraid: switch to pci_alloc_irq_vectors
> 
> EXTERNAL EMAIL
> 
> 
> On 11/15/2016 08:33 PM, Raghava Aditya Renukunta wrote:
> > Hi Hannes,
> > Thank you for the patch
> >
> >> -Original Message-
> >> From: Hannes Reinecke [mailto:h...@suse.de]
> >> Sent: Monday, November 7, 2016 11:12 PM
> >> To: Martin K. Petersen
> >> Cc: Christoph Hellwig; James Bottomley; linux-scsi@vger.kernel.org;
> Hannes
> >> Reinecke; Hannes Reinecke; dl-esc-Aacraid Linux Driver
> >> Subject: [PATCH] aacraid: switch to pci_alloc_irq_vectors
> >>
> >> EXTERNAL EMAIL
> >>
> >>
> >> Use pci_alloc_irq_vectors and drop the hand-crafted
> >> interrupt affinity routines.
> >>
> >> Signed-off-by: Hannes Reinecke 
> >> Cc: Adaptec OEM Raid Solutions 
> >> ---
> >>  drivers/scsi/aacraid/aacraid.h  |  1 -
> >>  drivers/scsi/aacraid/comminit.c | 10 +++---
> >>  drivers/scsi/aacraid/commsup.c  | 25 +
> >>  drivers/scsi/aacraid/linit.c| 20 
> >>  4 files changed, 12 insertions(+), 44 deletions(-)
> >>
> >> diff --git a/drivers/scsi/aacraid/aacraid.h 
> >> b/drivers/scsi/aacraid/aacraid.h
> >> index 969c312..f059c14 100644
> >> --- a/drivers/scsi/aacraid/aacraid.h
> >> +++ b/drivers/scsi/aacraid/aacraid.h
> >> @@ -1246,7 +1246,6 @@ struct aac_dev
> >> u32 max_msix;   /* max. MSI-X vectors */
> >> u32 vector_cap; /* MSI-X vector capab.*/
> >> int msi_enabled;/* MSI/MSI-X enabled */
> >> -   struct msix_entry   msixentry[AAC_MAX_MSIX];
> >> struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */
> >> u8  adapter_shutdown;
> >> u32 handle_pci_error;
> >> diff --git a/drivers/scsi/aacraid/comminit.c
> b/drivers/scsi/aacraid/comminit.c
> >> index 341ea32..4f56b10 100644
> >> --- a/drivers/scsi/aacraid/comminit.c
> >> +++ b/drivers/scsi/aacraid/comminit.c
> >> @@ -378,16 +378,12 @@ void aac_define_int_mode(struct aac_dev
> *dev)
> >> if (msi_count > AAC_MAX_MSIX)
> >> msi_count = AAC_MAX_MSIX;
> >>
> >> -   for (i = 0; i < msi_count; i++)
> >> -   dev->msixentry[i].entry = i;
> >> -
> >> if (msi_count > 1 &&
> >> pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> >> min_msix = 2;
> >> -   i = pci_enable_msix_range(dev->pdev,
> >> -   dev->msixentry,
> >> -   min_msix,
> >> -   msi_count);
> >> +   i = pci_alloc_irq_vectors(dev->pdev,
> >> + min_msix, msi_count,
> >> + PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
> >> if (i > 0) {
> >> dev->msi_enabled = 1;
> >> msi_count = i;
> >> diff --git a/drivers/scsi/aacraid/commsup.c
> b/drivers/scsi/aacraid/commsup.c
> >> index 0aeecec..9e7551f 100644
> >> --- a/drivers/scsi/aacraid/commsup.c
> >> +++ b/drivers/scsi/aacraid/commsup.c
> >> @@ -2043,30 +2043,22 @@ int aac_acquire_irq(struct aac_dev *dev)
> >> int i;
> >> int j;
> >> int ret = 0;
> >> -   int cpu;
> >>
> >> -   cpu = cpumask_first(cpu_online_mask);
> >> if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> >> for (i = 0; i < dev->max_msix; i++) {
> >> dev->aac_msix[i].vector_no = i;
> >> dev->aac_msix[i].dev = dev;
> >> -   if (request_irq(dev->msixentry[i].vector,
> >> +   if (request_irq(pci_irq_vector(dev->pdev, i),
> >> dev->a_ops.adapter_intr,
> >> 0, "aacraid", 
> >> &(dev->aac_msix[i]))) {
> >> printk(KERN_ERR "%s%d: Failed to register 
> >> IRQ for vector
> >> %d.\n",
> >> dev->name, dev->id, i);
> >> for (j = 0 ; j < i ; j++)
> >> -   free_irq(dev->msixentry[j].vector,
> >> +   free_irq(pci_irq_vector(dev->pdev, 
> >> j),
> >>  &(dev->aac_msix[j]));
> >> pci_disable_msix(dev->pdev);
> >> ret = -1;
> >> }
> >> -   if (irq_set_affinity_hint(dev->msixentry[i].vector,
> >> -  

Re: [PATCH] libfc: fix seconds_since_last_reset miscalculation

2016-11-16 Thread Arnd Bergmann
On Tuesday, November 15, 2016 4:05:31 PM CET Johannes Thumshirn wrote:
> On Tue, Nov 15, 2016 at 02:50:17PM +, Bart Van Assche wrote:
> > On Tue, 2016-11-15 at 10:18 +0100, Johannes Thumshirn wrote:
> > > On Tue, Nov 08, 2016 at 03:04:43PM +, Bart Van Assche wrote:
> > > > I think the above code will miscalculate seconds_since_last_reset
> > > > if 
> > > > 'jiffies' wraps around after an lport has been created and before 
> > > > seconds_since_last_reset is computed. Shouldn't
> > > > seconds_since_last_reset 
> > > > be computed as follows?
> > > > 
> > > >   fc_stats->seconds_since_last_reset = (jiffies - boot_time) /
> > > > HZ;
> > > 
> > > But what happens when jiffies - boot_time becomes negative? Then we
> > > reintroduce the bug again and have 'fcoeadm -s' show weird values.
> > 
> > Hello Johannes,
> > 
> > If your concern is about 'jiffies' wrapping around on 32-bit systems
> > then you should use get_jiffies_64(). get_jiffies_64() - boot_time
> > can't become negative. It namely takes several million years before a
> > 64-bit HZ counter wraps around.
> 
> You're right. I'll respin using get_jiffies_64() and resent once it is tested.

Sorry for the bug I introduced and for not noticing this thread earlier.
Looking at this again now, I think it's clear that the bug was simply
mixing up the left and right side of the subtraction, the simple fix
would be

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 2d3133f62463..fe643f2195f0 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -311,7 +311,7 @@ struct fc_host_statistics *fc_get_host_stats(struct 
Scsi_Host *shost)
fc_stats = &lport->host_stats;
memset(fc_stats, 0, sizeof(struct fc_host_statistics));
 
-   fc_stats->seconds_since_last_reset = (lport->boot_time - jiffies) / HZ;
+   fc_stats->seconds_since_last_reset = (jiffies - lport->boot_time) / HZ;
 
for_each_possible_cpu(cpu) {
struct fc_stats *stats;

This works correctly across jiffies overflows, as long as there is at least one
reset for every jiffies overflow (49 days or more). If we can have longer times
between resets, then we could either use get_jiffies_64() or 
ktime_get_seconds().

The latter would only need a 32-bit variable (overflow is after 136 years).

Arnd
--
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: [PATCH 2/2] blk-mq: Avoid memory reclaim when remapping queues

2016-11-16 Thread Gabriel Krisman Bertazi
Bart Van Assche  writes:

> I don't think that GFP_NOWAIT is acceptable in this context. Have you
> tried GFP_NOIO instead of GFP_NOWAIT?

At first I used GFP_NOIO, but after reviewing gfp.h I convinced myself
GFP_NOWAIT was what I wanted because I was concerned about FS accesses
that aren't restricted in GFP_NOIO.  For some reason, I assumed this was
an issue.  I'm ok with the change and can submit a v2 shortly, after
more tests.  in fact, this will make the change more compliant with the
rest of block layer critical allocations that use GFP_NOIO.

Thanks,

-- 
Gabriel Krisman Bertazi

--
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: "hpsa: Change SAS transport devices to bus 0." commit breaks hpacucli on old controller firmware

2016-11-16 Thread brace77070

On 10/31/2016 02:06 PM, Don Brace wrote:

On 10/27/2016 01:15 PM, Jack Suter wrote:

Hi there,

Commit "hpsa: Change SAS transport devices to bus 0."
(09371d623c9c3dc6ed7f53ec8ab01d25f0c6c697) breaks the hpacucli utility
for some HP Smart Array controllers with old firmware.

Specifically, I have a P410 connected to an HP DL180 G6 running firmware
version 1.66. Yes, the firmware is old, but it works. On the 4.4 series
kernels and earlier, hpacucli works with no trouble. On 4.5 and later,
the hpsa driver reports errors  in the kernel log, and hpacucli reports
"Error: No controllers detected."

Oct 27 15:50:30 hostname kernel: [   32.189495] hpsa :06:00.0: scsi
0:0:0:0: added RAID  HP   P410 controller
SSDSmartPathCap- En- Exp=1
Oct 27 15:50:30 hostname kernel: [   32.190054] hpsa :06:00.0:
addition failed -19, device not added.

Reverting the above commit resolves both the hpsa errors and the
hpacucli error when tested with kernel 4.7.9.

In addition to this troublesome server, I have a handful of servers with
P410 controllers and firmware versions ranging from 3.52 to 6.60. All of
them work with the 09371d62 commit in place, which leads me to believe
it is just this old 1.66 firmware that is incompatible.

While a firmware upgrade seems like the simple solution, I think this
should be considered a bug/regression due to it breaking functionality
that previously worked. It appears others may have run into this issue
too:
http://superuser.com/questions/1093124/coreos-hp410-raid1-device-not-added-19 



Some dmesg output (grep -e hpsa -e sg) is below from both a 4.4.2 kernel
(working) and 4.5.7 kernel (broken). Note the change in SCSI address
from 0:3:0:0 to 0:0:0:0.

Please let me know if you need me to do any testing to help resolve
this.

Jack Suter

I discussed this with the ssacli developers and they do not look
at the bus, but I see "device not added" messages that
should not be there. I'll attack your issue from that
perspective.

Thanks,
Don Brace


The root cause is that this older firmware is not scsi revision 5 and 
thus we add the

controller at the end of the list, not at the beginning.

if (is_scsi_rev_5(h))
raid_ctlr_position = 0;
else
raid_ctlr_position = nphysicals + nlogicals;

So the first logical volume gets BTL 0:0:0 and then we attempt to add in 
the controller
using the same BTL values at the end of the list. Thus you get the 
"device not added" messages.


The change to bus 0 was because the SAS transport is using bus 0 and 
there was a
discrepancy in what the driver was putting the controller on and what 
the SAS

transport was actually using.

I'll work on a patch to resolve this for you.


Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation



Kernel 4.4.2
Oct 27 15:28:07 hostname kernel: [1.461160] hpsa :06:00.0: can't
disable ASPM; OS doesn't have ASPM control
Oct 27 15:28:07 hostname kernel: [1.461632] hpsa :06:00.0: MSI-X
capable controller
Oct 27 15:28:07 hostname kernel: [1.463363] hpsa :06:00.0:
Logical aborts not supported
Oct 27 15:28:07 hostname kernel: [1.463619] hpsa :06:00.0: HP
SSD Smart Path aborts not supported
Oct 27 15:28:07 hostname kernel: [1.495824] scsi host0: hpsa
Oct 27 15:28:07 hostname kernel: [1.558535] hpsa :06:00.0: scsi
0:0:0:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.558992] hpsa :06:00.0: scsi
0:0:1:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.559441] hpsa :06:00.0: scsi
0:0:2:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.559890] hpsa :06:00.0: scsi
0:0:3:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.560338] hpsa :06:00.0: scsi
0:0:4:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.560786] hpsa :06:00.0: scsi
0:0:5:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.561234] hpsa :06:00.0: scsi
0:0:6:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.561681] hpsa :06:00.0: scsi
0:0:7:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.562131] hpsa :06:00.0: scsi
0:0:8:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [1.562579] hpsa :06:00.0: scsi
0:0:9:0: masked Direct-Access ATA  WDC WD2002FAEX-0 PHYS DRV
SSDSmartPathCap- En- Exp=0
Oct 27 15:28:07 hostname kernel: [ 

Re: [PATCH] mvsas: fix command_active typo

2016-11-16 Thread Johannes Thumshirn
On Wed, Nov 16, 2016 at 04:08:34PM +0100, Arnd Bergmann wrote:
> gcc-7 notices that the condition in mvs_94xx_command_active looks
> suspicious:
> 
> drivers/scsi/mvsas/mv_94xx.c: In function 'mvs_94xx_command_active':
> drivers/scsi/mvsas/mv_94xx.c:671:15: error: '<<' in boolean context, did you 
> mean '<' ? [-Werror=int-in-bool-context]
> 
> This was introduced when the mv_printk() statement got added,
> and leads to the condition being ignored. This is probably harmless.
> 
> Changing '&&' to '&' makes the code look reasonable, as we check the
> command bit before setting and printing it.
> 
> Fixes: a4632aae8b66 ("[SCSI] mvsas: Add new macros and functions")
> Signed-off-by: Arnd Bergmann 
> ---

Looks reasonable,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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


[PATCH] bfa: turn bfa_mem_{kva,dma}_setup into inline functions

2016-11-16 Thread Arnd Bergmann
These two macros cause lots of warnings with gcc-7:

drivers/scsi/bfa/bfa_svc.c: In function 'bfa_fcxp_meminfo':
drivers/scsi/bfa/bfa_svc.c:521:103: error: '*' in boolean context, suggest '&&' 
instead [-Werror=int-in-bool-context]

Using inline functions makes them much more readable and avoids
the warnings.

Signed-off-by: Arnd Bergmann 
---
 drivers/scsi/bfa/bfa_ioc.h | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
index 523fb02109b6..c27ed80f12ab 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -111,20 +111,24 @@ struct bfa_meminfo_s {
struct bfa_mem_kva_s kva_info;
 };
 
-/* BFA memory segment setup macros */
-#define bfa_mem_dma_setup(_meminfo, _dm_ptr, _seg_sz) do { \
-   ((bfa_mem_dma_t *)(_dm_ptr))->mem_len = (_seg_sz);  \
-   if (_seg_sz)\
-   list_add_tail(&((bfa_mem_dma_t *)_dm_ptr)->qe,  \
- &(_meminfo)->dma_info.qe);\
-} while (0)
+/* BFA memory segment setup helpers */
+static inline void bfa_mem_dma_setup(struct bfa_meminfo_s *meminfo,
+struct bfa_mem_dma_s *dm_ptr,
+size_t seg_sz)
+{
+   dm_ptr->mem_len = seg_sz;
+   if (seg_sz)
+   list_add_tail(&dm_ptr->qe, &meminfo->dma_info.qe);
+}
 
-#define bfa_mem_kva_setup(_meminfo, _kva_ptr, _seg_sz) do {\
-   ((bfa_mem_kva_t *)(_kva_ptr))->mem_len = (_seg_sz); \
-   if (_seg_sz)\
-   list_add_tail(&((bfa_mem_kva_t *)_kva_ptr)->qe, \
- &(_meminfo)->kva_info.qe);\
-} while (0)
+static inline void bfa_mem_kva_setup(struct bfa_meminfo_s *meminfo,
+struct bfa_mem_kva_s *kva_ptr,
+size_t seg_sz)
+{
+   kva_ptr->mem_len = seg_sz;
+   if (seg_sz)
+   list_add_tail(&kva_ptr->qe, &meminfo->kva_info.qe);
+}
 
 /* BFA dma memory segments iterator */
 #define bfa_mem_dma_sptr(_mod, _i) (&(_mod)->dma_seg[(_i)])
-- 
2.9.0

--
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: [PATCH] fnic: Correcting rport check location in fnic_queuecommand_lck

2016-11-16 Thread Tomas Henzl
On 16.11.2016 09:54, Satish Kharat wrote:
> Signed-off-by: Satish Kharat 
> Signed-off-by: Sesidhar Baddela 

Looks good,

Reviewed-by: Tomas Henzl 

Tomas

--
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


[PATCH] mvsas: fix command_active typo

2016-11-16 Thread Arnd Bergmann
gcc-7 notices that the condition in mvs_94xx_command_active looks
suspicious:

drivers/scsi/mvsas/mv_94xx.c: In function 'mvs_94xx_command_active':
drivers/scsi/mvsas/mv_94xx.c:671:15: error: '<<' in boolean context, did you 
mean '<' ? [-Werror=int-in-bool-context]

This was introduced when the mv_printk() statement got added,
and leads to the condition being ignored. This is probably harmless.

Changing '&&' to '&' makes the code look reasonable, as we check the
command bit before setting and printing it.

Fixes: a4632aae8b66 ("[SCSI] mvsas: Add new macros and functions")
Signed-off-by: Arnd Bergmann 
---
 drivers/scsi/mvsas/mv_94xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c
index 4c57d9abce7b..7de5d8d75480 100644
--- a/drivers/scsi/mvsas/mv_94xx.c
+++ b/drivers/scsi/mvsas/mv_94xx.c
@@ -668,7 +668,7 @@ static void mvs_94xx_command_active(struct mvs_info *mvi, 
u32 slot_idx)
 {
u32 tmp;
tmp = mvs_cr32(mvi, MVS_COMMAND_ACTIVE+(slot_idx >> 3));
-   if (tmp && 1 << (slot_idx % 32)) {
+   if (tmp & 1 << (slot_idx % 32)) {
mv_printk("command active %08X,  slot [%x].\n", tmp, slot_idx);
mvs_cw32(mvi, MVS_COMMAND_ACTIVE + (slot_idx >> 3),
1 << (slot_idx % 32));
-- 
2.9.0

--
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


[PATCH] scsi: dmx3191d: use module_pci_driver

2016-11-16 Thread Geliang Tang
Use module_pci_driver() helper to simplify the code.

Signed-off-by: Geliang Tang 
---
 drivers/scsi/dmx3191d.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
index 3aa4657..6af3394 100644
--- a/drivers/scsi/dmx3191d.c
+++ b/drivers/scsi/dmx3191d.c
@@ -153,18 +153,7 @@ static struct pci_driver dmx3191d_pci_driver = {
.remove = dmx3191d_remove_one,
 };
 
-static int __init dmx3191d_init(void)
-{
-   return pci_register_driver(&dmx3191d_pci_driver);
-}
-
-static void __exit dmx3191d_exit(void)
-{
-   pci_unregister_driver(&dmx3191d_pci_driver);
-}
-
-module_init(dmx3191d_init);
-module_exit(dmx3191d_exit);
+module_pci_driver(dmx3191d_pci_driver);
 
 MODULE_AUTHOR("Massimo Piccioni ");
 MODULE_DESCRIPTION("Domex DMX3191D SCSI driver");
-- 
2.9.3

--
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


[PATCH] scsi: a100u2w: use module_pci_driver

2016-11-16 Thread Geliang Tang
Use module_pci_driver() helper to simplify the code.

Signed-off-by: Geliang Tang 
---
 drivers/scsi/a100u2w.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 8086bd0..b2942ec 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -1222,19 +1222,8 @@ static struct pci_driver inia100_pci_driver = {
.remove = inia100_remove_one,
 };
 
-static int __init inia100_init(void)
-{
-   return pci_register_driver(&inia100_pci_driver);
-}
-
-static void __exit inia100_exit(void)
-{
-   pci_unregister_driver(&inia100_pci_driver);
-}
+module_pci_driver(inia100_pci_driver);
 
 MODULE_DESCRIPTION("Initio A100U2W SCSI driver");
 MODULE_AUTHOR("Initio Corporation");
 MODULE_LICENSE("Dual BSD/GPL");
-
-module_init(inia100_init);
-module_exit(inia100_exit);
-- 
2.9.3

--
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: [PATCH v3 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly

2016-11-16 Thread Johannes Thumshirn
On Tue, Nov 15, 2016 at 04:39:33PM +0100, Johannes Thumshirn wrote:
> On Tue, Nov 15, 2016 at 03:31:27PM +0100, Steffen Maier wrote:
> > Hi Johannes,
> > 
> > On 11/15/2016 12:56 PM, Johannes Thumshirn wrote:
> > > On Tue, Oct 25, 2016 at 09:43:14AM +0200, Johannes Thumshirn wrote:
> > > > On Fri, Oct 14, 2016 at 09:38:21AM +0200, Johannes Thumshirn wrote:
> > > > > On Thu, Oct 13, 2016 at 05:55:11PM +0200, Steffen Maier wrote:
> > > > > > Hm, still behaves for me like I reported for v2:
> > > > > > http://marc.info/?l=linux-scsi&m=147637177902937&w=2
> > > 
> > > [...]
> > > 
> > > > > 
> > > > > The rational behind this is, in fc_req_to_bsgjob() we're assigning
> > > > > job->request as req->cmd and job->request_len = req->cmd_len. But 
> > > > > without
> > > > > checkinf job->request_len we don't know whether we're save to touch
> > > > > job->request (a.k.a. bsg_request).
> > > > 
> > > > Hi Steffen,
> > > > Did you have any chance testing this? I hacked fcping to work with 
> > > > non-FCoE
> > > > and rports as well and tested with FCoE and lpfc. No problems seen from 
> > > > my
> > > > side. I've also pused the series (With this change folded in) to my git
> > > > tree at [1] if this helps you in any way.
> > > > 
> > > > [1] 
> > > > https://git.kernel.org/cgit/linux/kernel/git/jth/linux.git/log/?h=scsi-bsg-rewrite-v4
> > > > 
> > > 
> > > So I finally have a test system up and running. I have good and bad news. 
> > > The
> > > good news is, I can't get the system crashing with my patches, the bad 
> > > news is
> > > I can't get zfcp_ping and zfcp_show to output something but 
> > > HBA_STATUS_ERROR
> > > with my patches and without.
> 
> Please ignore my last mails, apparently it's a wise idea to check which user
> id one has before running zfcp_ping...
> 
> The good news for this is, I can now recreate the crashes you have and thus
> have a chance to fix them :-)

So JFTR, I was able to fix the 1 problem introduced by this patch, it's the
follwoing hunk:
@@ -3726,9 +3729,9 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport 
*rport,
if (i->f->dd_bsg_size)
job->dd_data = (void *)&job[1];
spin_lock_init(&job->job_lock);
-   job->request = (struct fc_bsg_request *)req->cmd;
+   bsg_request = (struct fc_bsg_request *)req->cmd;
job->request_len = req->cmd_len;
-   job->reply = req->sense;
+   bsg_reply = req->sense;
job->reply_len = SCSI_SENSE_BUFFERSIZE; /* Size of sense buffer
 * allocated */
if (req->bio) {

But as fc_req_to_bsgjob() get's deleted in Patch 15/16 the problem is
re-introduced. Unfortunately the fix isn't as trivial as for 2/16 so I'm still
trying to nail it down.

Thanks,
Johannes

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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: [PATCH 02/11] hisi_sas: alloc queue id of slot according to device id

2016-11-16 Thread John Garry

On 16/11/2016 01:41, Zhangfei Gao wrote:

On Mon, Nov 7, 2016 at 8:48 PM, John Garry  wrote:

From: Xiang Chen 

Currently slots are allocated from queues in a round-robin fashion.
This causes a problem for internal commands in device mode. For this
mode, we should ensure that the internal abort command is the last
command seen in the host for that device. We can only ensure this when
we place the internal abort command after the preceding commands for
device that in the same queue, as there is no order in which the host
will select a queue to execute the next command.


Is there performance penalty, since only one queue is supported for a device.


Hi Zhangfei,

From testing I have not seen any noteable performance change. However, 
please note the comment on mq, below.


Cheers,
John





This queue restriction makes supporting scsi mq more tricky in
the future, but should not be a blocker.

Note: Even though v1 hw does not support internal abort, the
  allocation method is chosen to be the same for consistency.

Signed-off-by: Xiang Chen 
Signed-off-by: John Garry 


Reviewed-by: Zhangfei Gao 
--
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

.




--
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


[PATCH] fnic: Correcting rport check location in fnic_queuecommand_lck

2016-11-16 Thread Satish Kharat
Signed-off-by: Satish Kharat 
Signed-off-by: Sesidhar Baddela 
---
 drivers/scsi/fnic/fnic_scsi.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index bfaba06..2544a37 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -441,30 +441,38 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, 
void (*done)(struct scsi_
unsigned long ptr;
spinlock_t *io_lock = NULL;
int io_lock_acquired = 0;
+   struct fc_rport_libfc_priv *rp;
 
if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
return SCSI_MLQUEUE_HOST_BUSY;
 
rport = starget_to_rport(scsi_target(sc->device));
+   if (!rport) {
+   FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+   "returning DID_NO_CONNECT for IO as rport is 
NULL\n");
+   sc->result = DID_NO_CONNECT << 16;
+   done(sc);
+   return 0;
+   }
+
ret = fc_remote_port_chkready(rport);
if (ret) {
+   FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+   "rport is not ready\n");
atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
sc->result = ret;
done(sc);
return 0;
}
 
-   if (rport) {
-   struct fc_rport_libfc_priv *rp = rport->dd_data;
-
-   if (!rp || rp->rp_state != RPORT_ST_READY) {
-   FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+   rp = rport->dd_data;
+   if (!rp || rp->rp_state != RPORT_ST_READY) {
+   FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
"returning DID_NO_CONNECT for IO as rport is 
removed\n");
-   atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
-   sc->result = DID_NO_CONNECT<<16;
-   done(sc);
-   return 0;
-   }
+   atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
+   sc->result = DID_NO_CONNECT<<16;
+   done(sc);
+   return 0;
}
 
if (lp->state != LPORT_ST_READY || !(lp->link_up))
-- 
2.5.5

--
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