From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id B26DE8DA6 for ; Thu, 5 Jul 2018 10:30:40 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 2F3C3214AB; Thu, 5 Jul 2018 04:30:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 05 Jul 2018 04:30:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=29O07OXPIOt0BQ8RBEmFhcoRCc o9Uy05mmVTs9O1Olg=; b=oiJmZ04j/h2IiUBwJJi83gQBFIautbUivxXGCK3KDj hsZpljBS+IGc+k27sj4SgBkXtGmmlgubMcIfZ03I5f4bt4P8jJNBWKvidGk4+gC/ xtHkSB2ApS8+QJuotC20BC3MtpFtZIVCt9UT/IrPi2STzzpcdZmNu2en5Fqm4R4r 0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=29O07O XPIOt0BQ8RBEmFhcoRCco9Uy05mmVTs9O1Olg=; b=ca3Mz3MoZhHu0pGNXjCm8n pwHVHudRdBDvMkbu/l9/uT4IDWR84gcgKwgV5d0+7Caok6wJlPXdMVyhLUmbuhWK kR8bEixC9fHbgVXfZzPEv+0mwFsQpRcBOOmF6sddWpwwn+jVK+5K1mc9ybwsCUlX 2EJH/Fwccfb5yOPN93aHHizE51B7gpeG3fbMR+1yHxXmFFeQ1xTmktPF8mOGKtAU uEWS9FXZXo8BwO/oVq4VsIXk+02IcNeRWcq3KchnaTwtn1AnOUenOJmN9gYF4xJT L7L0hskKIuv+TR37jQ26ryX1rZMexyDuk2fSWgHalfyO/jLaY2C3aKinTUHG0aYA == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 5761DE4649; Thu, 5 Jul 2018 04:30:37 -0400 (EDT) From: Thomas Monjalon To: "Guo, Jia" Cc: dev@dpdk.org, stephen@networkplumber.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, motih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com, qi.z.zhang@intel.com, shaopeng.he@intel.com, bernard.iremonger@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, helin.zhang@intel.com Date: Thu, 05 Jul 2018 10:30:36 +0200 Message-ID: <1640513.v5es5KfRRd@xps> In-Reply-To: <2f9bb7bb-0647-5601-7e1f-1eba44890843@intel.com> References: <1498711073-42917-1-git-send-email-jia.guo@intel.com> <2407710.IcmoihaDi7@xps> <2f9bb7bb-0647-5601-7e1f-1eba44890843@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH V4 1/9] bus: introduce hotplug failure handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 08:30:41 -0000 05/07/2018 08:23, Guo, Jia: > > On 7/4/2018 3:55 PM, Thomas Monjalon wrote: > > 04/07/2018 09:16, Guo, Jia: > >> On 7/4/2018 6:21 AM, Thomas Monjalon wrote: > >>> 29/06/2018 12:30, Jeff Guo: > >>>> /** > >>>> + * Implementation a specific hot plug handler, which is responsible > >>>> + * for handle the failure when hot remove the device, guaranty the system > >>>> + * would not crash in the case. > >>>> + * @param dev > >>>> + * Pointer of the device structure. > >>>> + * > >>>> + * @return > >>>> + * 0 on success. > >>>> + * !0 on error. > >>>> + */ > >>>> +typedef int (*rte_bus_hotplug_handler_t)(struct rte_device *dev); > >>> [...] > >>>> @@ -211,6 +224,8 @@ struct rte_bus { > >>>> rte_bus_parse_t parse; /**< Parse a device name */ > >>>> struct rte_bus_conf conf; /**< Bus configuration */ > >>>> rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */ > >>>> + rte_bus_hotplug_handler_t hotplug_handler; > >>>> + /**< handle hot plug on bus */ > >>> The name is misleading. > >>> It is to handle unplugging but is called "hotplug". > >> ok, so i prefer hotplug_failure_handler than hot_unplug_handler, since > >> it is more explicit for failure handle, and more clearly. > >> > >>> In order to demonstrate how the handler is used, you should > >>> introduce the code using this handler in the same patch. > >>> > >> sorry, i check the history of rte_bus.h, and the way is introduce ops at > >> first, second implement in specific bus, then come across the usage. > >> I think that way clear and make sense. what do you think? > >> Anyway, i will check the commit log if is there any misleading. > > I think it is better to call ops when they are introduced, > > and implement the ops in second step. > > > > Hi, Thomas > > sorry but i want to detail the relationship of the ops and api as bellow > to try if we can get the better sequence. > > Patch num: > > 1: introduce ops hotplug_failure_handler > > 2: implement ops hotplug_failure_handler > > 3:introduce ops sigbus_handler. > > 4:implement ops sigbus_handler > > 5: introduce helper rte_bus_sigbus_handler to call the ops sigbus_handler > > 6: introduce the mechanism to call helper rte_bus_sigbus_handler and > call hotplug_failure_handler. > > If per you said , could I modify the sequence like 6->5->3->4->1->2? I > don't think it will make sense, and might be more confused. > > And I think should be better that introduce each ops just say item, then > when introduce the caller patch, the functional is ready to use by the > patch. > > > if i did not got your point and you have other better sequence about > that please explicit to let me know. Thanks. The main concern is to be able to understand each patch separately. When introducing a new op, we need to understand how it will be used. But actually, no need to change patch organization, you just need to provide a clear doxygen documentation, and introduce the context in the commit log.