From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbbJTJXP (ORCPT ); Tue, 20 Oct 2015 05:23:15 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:47924 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbbJTJXJ (ORCPT ); Tue, 20 Oct 2015 05:23:09 -0400 Subject: Re: [PATCH 13/25] scsi: hisi_sas: add path from phyup irq to SAS framework To: Arnd Bergmann References: <1444663237-238302-1-git-send-email-john.garry@huawei.com> <4269975.xfCo9ut8KK@wuerfel> <56250473.9090700@huawei.com> <8738374.sFXdg3OStu@wuerfel> CC: , , , , , , , , From: John Garry Message-ID: <562604B2.7060101@huawei.com> Date: Tue, 20 Oct 2015 10:09:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <8738374.sFXdg3OStu@wuerfel> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.137.251] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.562607FA.00F7,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c57b235ae65483e0f246f64fa1cc98a5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> We could create a work_struct for each event, which would be fine. > > Yes, that would be the normal way to do it. You initialize the work > structures from the initial probe function to have the right > callbacks, and then you just queue the right one when you need to > defer an event. > > How many different events are there? > We currently only support processing 2 events in the workqueue: phy up and control phy. However we may want to use more in the future, like hotplug (for phy down) event. >> However we would sometimes still need some way of passing data to >> the event, like the phy control example. > > Do you mean the 'int func' argument to hisi_sas_control_phy_work? Yes > It sounds like that would again just be more different work_structs. > > At some point that might get silly (having 10 or more work structs > per phy), but then you could restructure the code to use something > other that work queues to get from interrupt context to process > context, e.g. a threaded interrupt handler. I'll check on this. We need to consider how to pass the argument for the control phy case. > > Note that the current code is not only unusual but also fragile > because you rely on GFP_ATOMIC memory allocations from the interrupt > handler, and they tend to eventually fail. Understood. For what it's worth, I was just following other SAS drivers as a refernce: see pm8001_handle_event() and mvs_handle_event() > > Arnd -- To unsubscribe from this list: send the line "unsubscribe > linux-scsi" in the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > > . > Thanks, John