From: wangyijing <wangyijing@huawei.com>
To: Johannes Thumshirn <jthumshirn@suse.de>,
<jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <chenqilin2@huawei.com>, <hare@suse.com>,
<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<chenxiang66@hisilicon.com>, <huangdaode@hisilicon.com>,
<wangkefeng.wang@huawei.com>, <zhaohongjiang@huawei.com>,
<dingtianhong@huawei.com>, <guohanjun@huawei.com>,
<yanaijie@huawei.com>, <hch@lst.de>, <dan.j.williams@intel.com>,
<emilne@redhat.com>, <thenzl@redhat.com>, <wefu@redhat.com>,
<charles.chenxin@huawei.com>, <chenweilong@huawei.com>,
Yousong He <heyousong@huawei.com>
Subject: Re: [PATCH v2 1/2] libsas: Don't process sas events in static works
Date: Wed, 14 Jun 2017 17:28:34 +0800 [thread overview]
Message-ID: <594101C2.702@huawei.com> (raw)
In-Reply-To: <3c713ab7-c958-ab1a-0a12-cdd5e876e845@suse.de>
在 2017/6/14 17:18, Johannes Thumshirn 写道:
> On 06/14/2017 11:04 AM, wangyijing wrote:
>>>> static void notify_ha_event(struct sas_ha_struct *sas_ha, enum ha_event event)
>>>> {
>>>> + struct sas_ha_event *ev;
>>>> +
>>>> BUG_ON(event >= HA_NUM_EVENTS);
>>>>
>>>> - sas_queue_event(event, &sas_ha->pending,
>>>> - &sas_ha->ha_events[event].work, sas_ha);
>>>> + ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
>>>> + if (!ev)
>>>> + return;
>>> GFP_ATOMIC allocations can fail and then no events will be queued *and* we
>>> don't report the error back to the caller.
>>>
>>
>> Yes, it's really a problem, but I don't find a better solution, do you have some suggestion ?
>
> Something like this?
>
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c
> b/drivers/scsi/hisi_sas/hisi_sas_main.c
> index d622db502ec9..27cd7307d308 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
> @@ -894,7 +894,11 @@ static int hisi_sas_controller_reset(struct
> hisi_hba *hisi_hba)
> hisi_sas_release_tasks(hisi_hba);
> spin_unlock_irqrestore(&hisi_hba->lock, flags);
>
> - sas_ha->notify_ha_event(sas_ha, HAE_RESET);
> + rc = sas_ha->notify_ha_event(sas_ha, HAE_RESET);
> + if (rc) {
> + dev_warn(dev, "failed to queue HA event (%d)\n",
> rc);
> + goto out;
> + }
> dev_dbg(dev, "controller reset successful!\n");
> } else
> return -1;
> diff --git a/drivers/scsi/libsas/sas_event.c
> b/drivers/scsi/libsas/sas_event.c
> index aadbd5314c5c..6c91fb31f891 100644
> --- a/drivers/scsi/libsas/sas_event.c
> +++ b/drivers/scsi/libsas/sas_event.c
> @@ -116,7 +116,7 @@ void sas_enable_revalidation(struct sas_ha_struct *ha)
> mutex_unlock(&ha->disco_mutex);
> }
>
> -static void notify_ha_event(struct sas_ha_struct *sas_ha, enum ha_event
> event)
> +static int notify_ha_event(struct sas_ha_struct *sas_ha, enum ha_event
> event)
> {
> BUG_ON(event >= HA_NUM_EVENTS);
>
> diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
> index dd0f72c95abe..5d9cd6d20855 100644
> --- a/include/scsi/libsas.h
> +++ b/include/scsi/libsas.h
> @@ -415,7 +415,7 @@ struct sas_ha_struct {
> * their siblings when forming wide ports */
>
> /* LLDD calls these to notify the class of an event. */
> - void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);
> + int (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);
> void (*notify_port_event)(struct asd_sas_phy *, enum port_event);
> void (*notify_phy_event)(struct asd_sas_phy *, enum phy_event);
This make sense, return a fail status and report it to the callers.
>
>
next prev parent reply other threads:[~2017-06-14 9:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 7:33 [PATCH v2 0/2] Enhance libsas hotplug feature Yijing Wang
2017-06-14 7:33 ` [PATCH v2 1/2] libsas: Don't process sas events in static works Yijing Wang
2017-06-14 8:48 ` Johannes Thumshirn
2017-06-14 9:04 ` wangyijing
2017-06-14 9:18 ` Johannes Thumshirn
2017-06-14 9:28 ` wangyijing [this message]
2017-06-14 13:08 ` John Garry
2017-06-15 7:37 ` wangyijing
2017-06-15 8:00 ` John Garry
2017-06-15 8:21 ` wangyijing
2017-06-14 7:33 ` [PATCH v2 2/2] libsas: Enhance libsas hotplug Yijing Wang
2017-06-14 8:57 ` Johannes Thumshirn
2017-06-14 9:15 ` wangyijing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=594101C2.702@huawei.com \
--to=wangyijing@huawei.com \
--cc=charles.chenxin@huawei.com \
--cc=chenqilin2@huawei.com \
--cc=chenweilong@huawei.com \
--cc=chenxiang66@hisilicon.com \
--cc=dan.j.williams@intel.com \
--cc=dingtianhong@huawei.com \
--cc=emilne@redhat.com \
--cc=guohanjun@huawei.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=heyousong@huawei.com \
--cc=huangdaode@hisilicon.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=thenzl@redhat.com \
--cc=wangkefeng.wang@huawei.com \
--cc=wefu@redhat.com \
--cc=yanaijie@huawei.com \
--cc=zhaohongjiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).