From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 9E34A1B471 for ; Fri, 29 Jun 2018 14:52:18 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id l2-v6so8177866wro.7 for ; Fri, 29 Jun 2018 05:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=igV3PNY83dEGMcpZa+bN+h4/lsP+komb1v/dD4sC28g=; b=UZKpqau0gTKXELk7Cp0tfyrbM44gNBU1Jzm3gPlkM+S3H1RcvGDkvUvlrDqDnSnrWK 90Sxo9HGHt/1nniKvlkAqexyt/LWXoCehla6LfUl0KIqpTZ6io26fZZz92Tyvm0bfwSy u8cZ0miQnUb8KuaGY4qJ+rz1HVcqjqrkVXn/IGRLBr+fASOK1btIb2jNDiDMRte6GM3I bjmMpo4F7jLHGItEL12rMThkFMCRfK15yt5g2+NzbRQOM88N3JjGkMQVxxeZ9MSxz/qM zhiQzgf7iCq86jjXStBLF23u/gxvCDxHL3QxnofPriTDyodx2v4tmCgyEb7bFprNX0ZX qvUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=igV3PNY83dEGMcpZa+bN+h4/lsP+komb1v/dD4sC28g=; b=GXJSRayz7wd89/kYgoKeOjPTjfFXvcIz1eofqfc8MEYqys/cmo29QQp/A6skHeyGxV +Imof5DQ1OK9U5NHz8Lm3dS+0HYFXytjf8QKeP/6PhIQb5xbJPV4cN6lxMCvD3mTzFxL JvX8/bTEjDTt1YTYvemgZt06dsgl4S0Zw1+E6mOWKZ3TLBlN7W1nXveQByxvPk/6PuIF uOUkIXuRYgzS+Yh4NfwlkRcprXwePUh59uyYkYAFFnd5kYyoP5Q3aY97E0VLlb4yo3PX ZSNjhyN0aXHqQ8lHoE8w0GSFtDzfYOo4dimg9fOzg2VwFyhLw93EMP3fXDGU8B+qszZs 8vsA== X-Gm-Message-State: APt69E39rKHg+gdQXKgWnWniyBPc4BapJme4F1ETC4y6Qs9toktdNPli RIG/4CFgIRP3tt7OIE+KsrL7dw== X-Google-Smtp-Source: AAOMgpdvd5hO++Xq+lz1Ib4u89Y2AyblwN4WGPaLbIAfy8AsMAlaw1N73geqO9WqvA6HWcK3OxQh+w== X-Received: by 2002:adf:9084:: with SMTP id i4-v6mr1838571wri.146.1530276738149; Fri, 29 Jun 2018 05:52:18 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id y8-v6sm9444558wrs.0.2018.06.29.05.52.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 05:52:17 -0700 (PDT) Date: Fri, 29 Jun 2018 14:52:00 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: "Ananyev, Konstantin" Cc: "Guo, Jia" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "Wu, Jingjing" , "thomas@monjalon.net" , "motih@mellanox.com" , "matan@mellanox.com" , "Van Haaren, Harry" , "Zhang, Qi Z" , "He, Shaopeng" , "Iremonger, Bernard" , "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "Zhang, Helin" Message-ID: <20180629125200.uefvrokdg5nqthrl@bidouze.vm.6wind.com> References: <1498711073-42917-1-git-send-email-jia.guo@intel.com> <1530268248-7328-1-git-send-email-jia.guo@intel.com> <1530268248-7328-6-git-send-email-jia.guo@intel.com> <2601191342CEEE43887BDE71AB977258C0C43A49@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB977258C0C43C71@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2601191342CEEE43887BDE71AB977258C0C43C71@irsmsx105.ger.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH V4 5/9] bus: add helper to handle sigbus 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: Fri, 29 Jun 2018 12:52:18 -0000 On Fri, Jun 29, 2018 at 12:21:39PM +0000, Ananyev, Konstantin wrote: > > > > -----Original Message----- > > From: Guo, Jia > > Sent: Friday, June 29, 2018 12:23 PM > > To: Ananyev, Konstantin ; stephen@networkplumber.org; Richardson, Bruce > > ; Yigit, Ferruh ; gaetan.rivet@6wind.com; Wu, Jingjing > > ; thomas@monjalon.net; motih@mellanox.com; matan@mellanox.com; Van Haaren, Harry > > ; Zhang, Qi Z ; He, Shaopeng ; Iremonger, Bernard > > > > Cc: jblunck@infradead.org; shreyansh.jain@nxp.com; dev@dpdk.org; Zhang, Helin > > Subject: Re: [PATCH V4 5/9] bus: add helper to handle sigbus > > > > hi, konstantin > > > > > > On 6/29/2018 6:51 PM, Ananyev, Konstantin wrote: > > >> +int > > >> +rte_bus_sigbus_handler(const void *failure_addr) > > >> +{ > > >> + struct rte_bus *bus; > > >> + int old_errno = rte_errno; > > >> + int ret = 0; > > >> + > > >> + rte_errno = 0; > > >> + > > >> + bus = rte_bus_find(NULL, bus_handle_sigbus, failure_addr); > > >> + if (bus == NULL) { > > >> + RTE_LOG(ERR, EAL, "No bus can handle the sigbus error!"); > > >> + ret = -1; > > >> + } else if (rte_errno != 0) { > > >> + RTE_LOG(ERR, EAL, "Failed to handle the sigbus error!"); > > >> + ret = -1; > > >> + } > > >> + > > >> + /* if sigbus not be handled, return back old errno. */ > > >> + if (ret) > > >> + rte_errno = old_errno; > > > Hmm, not sure why we need to set/restore rte_errno here? > > > > restore old_errno just use to let caller know that the generic sigbus > > still not handler by bus hotplug handler, that involve find a bus > > handle but failed and can not find a hander, and can corresponding use > > the previous sigbus handler to process it. > > that is also unwser your question in other patch. do you think that make > > sense? > > Sorry, still don't understand the intention. > Suppose rte_bus_find() will return NULL, in that case you'll setup rte_errno > to what it was before calling that function. > If the returned bus is not NULL, but bus_find() set's an rte_errno, > you still would restore rte_ernno? > What is the prupose? > Why do you need to touch rte_errno at all in that function? > Konstantin > The way it is written here does not work, but the intention is to make sure that a previous error is still catched. Something like that: int old_errno = rte_errno; rte_errno = 0; rte_eal_call(); if (rte_errno) return -1; else { rte_errno = old_errno; return 0; } If someone calls the function while rte_errno is already set, then an earlier error would be hidden by setting rte_errno to 0 within the function. I'm not sure this is useful, but sometimes when using errno within a library call I'm bothered that I am masking previous issues. Should it be avoided? -- Gaëtan Rivet 6WIND