Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755881AbeAHHiq (ORCPT + 1 other); Mon, 8 Jan 2018 02:38:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:39290 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754793AbeAHHio (ORCPT ); Mon, 8 Jan 2018 02:38:44 -0500 Subject: Re: [PATCH v5 2/7] scsi: libsas: shut down the PHY if events reached the threshold From: Hannes Reinecke To: Jason Yan , martin.petersen@oracle.com, jejb@linux.vnet.ibm.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, john.garry@huawei.com, zhaohongjiang@huawei.com, hare@suse.com, dan.j.williams@intel.com, jthumshirn@suse.de, Raj.Dinesh@microsemi.com, hch@lst.de, huangdaode@hisilicon.com, chenxiang66@hisilicon.com, xiyou.wangcong@gmail.com, Ewan Milne , Tomas Henzl References: <20171208094210.24887-1-yanaijie@huawei.com> <20171208094210.24887-3-yanaijie@huawei.com> Message-ID: <6ef7025e-f330-ede4-d194-096efd5d7c56@suse.de> Date: Mon, 8 Jan 2018 08:38:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 12/15/2017 01:18 PM, Hannes Reinecke wrote: > On 12/08/2017 10:42 AM, Jason Yan wrote: >> If the PHY burst too many events, we will alloc a lot of events for the >> worker. This may leads to memory exhaustion. >> >> Dan Williams suggested to shut down the PHY if the events reached the >> threshold, because in this case the PHY may have gone into some >> erroneous state. Users can re-enable the PHY by sysfs if they want. >> >> We cannot use the fixed memory pool because if we run out of events, the >> shut down event and loss of signal event will lost too. The events still >> need to be allocated and processed in this case. >> >> Suggested-by: Dan Williams >> Signed-off-by: Jason Yan >> CC: John Garry >> CC: Johannes Thumshirn >> CC: Ewan Milne >> CC: Christoph Hellwig >> CC: Tomas Henzl >> --- >> drivers/scsi/libsas/sas_init.c | 33 ++++++++++++++++++++++++++++++++- >> drivers/scsi/libsas/sas_phy.c | 27 ++++++++++++++++++++++++++- >> include/scsi/libsas.h | 6 ++++++ >> 3 files changed, 64 insertions(+), 2 deletions(-) >> > Well, this still looks a bit error prone; what if the system runs out of > memory before the pool is exhausted? > (Also a threshold of 1024 events is a bit arbitrary; one might want to > adjust that). > > Couldn't you allocate two static events always (for shutdown and signal > loss), and then use a fixed pool? > Has actually been resolved by the next patch. Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)