From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 732BEA04B1; Thu, 7 Nov 2019 02:06:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A69B61C222; Thu, 7 Nov 2019 02:06:54 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 49E391C1E6 for ; Thu, 7 Nov 2019 02:06:53 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2019 17:06:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,276,1569308400"; d="scan'208";a="192658767" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 06 Nov 2019 17:06:51 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 6 Nov 2019 17:06:51 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by shsmsx102.ccr.corp.intel.com ([169.254.2.108]) with mapi id 14.03.0439.000; Thu, 7 Nov 2019 09:06:49 +0800 From: "Su, Simei" To: "Stillwell Jr, Paul M" , "Zhang, Qi Z" , "Ye, Xiaolong" , "Yang, Qiming" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] net/ice: fix segmentation fault for RSS init Thread-Index: AQHVlHvlLIuJ1Y822EWYMWXQjkOUk6d9yksAgAEXhdA= Date: Thu, 7 Nov 2019 01:06:48 +0000 Message-ID: <65F28F834D25B54B9EC1999B623071B30C481124@SHSMSX104.ccr.corp.intel.com> References: <1573024135-267218-1-git-send-email-simei.su@intel.com> <1573028777-185130-1-git-send-email-simei.su@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGEwMDI5OGYtMzVkOC00N2JhLThlOTAtYmY5MGVjNmE3MWIyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYXhKaXZEN2ptZ3ZuZlU3bE9mXC9JMDhHYTcwNGhwUVRLaEIyb0FvbWwyRlRsc2xxNWpWbmdxcFRMbjdZSmx5ZTcifQ== x-ctpclassification: CTP_NT x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/ice: fix segmentation fault for RSS init 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, Paul > -----Original Message----- > From: Stillwell Jr, Paul M > Sent: Thursday, November 7, 2019 12:10 AM > To: Su, Simei ; Zhang, Qi Z ; Y= e, > Xiaolong ; Yang, Qiming > Cc: dev@dpdk.org; Su, Simei > Subject: RE: [dpdk-dev] [PATCH v2] net/ice: fix segmentation fault for RS= S init >=20 > Disregard my previous email, I didn't see this one. See my comments inlin= e. >=20 > Paul >=20 > > -----Original Message----- > > From: dev On Behalf Of Simei Su > > Sent: Wednesday, November 6, 2019 12:26 AM > > To: Zhang, Qi Z ; Ye, Xiaolong > > ; Yang, Qiming > > Cc: dev@dpdk.org; Su, Simei > > Subject: [dpdk-dev] [PATCH v2] net/ice: fix segmentation fault for RSS > > init > > > > This patch fixes core dump issue when entering safe mode with a wrong > > package file. This patch also fixes build failure issue. > > > > Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") > > > > Signed-off-by: Simei Su > > --- > > drivers/net/ice/ice_hash.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c > > index > > 3381b45..08b2502 100644 > > --- a/drivers/net/ice/ice_hash.c > > +++ b/drivers/net/ice/ice_hash.c > > @@ -236,12 +236,12 @@ struct ice_hash_match_type > ice_hash_type_list[] > > =3D { static int ice_hash_init(struct ice_adapter *ad) { -struct > > ice_flow_parser *parser =3D NULL; > > +struct ice_flow_parser *parser; > > > > -if (ad->active_pkg_type =3D=3D ICE_PKG_TYPE_OS_DEFAULT) -parser =3D > > &ice_hash_parser_os; -else if (ad->active_pkg_type =3D=3D > > ICE_PKG_TYPE_COMMS) > > +if (ad->active_pkg_type =3D=3D ICE_PKG_TYPE_COMMS) > > parser =3D &ice_hash_parser_comms; > > +else > > +parser =3D &ice_hash_parser_os; >=20 > This doesn't make sense to me. Why set up a parser at all if we are in sa= fe > mode? Safe mode means 1 queue so there isn't anything to RSS to. It seems > like if we are in safe mode we should just return an error here with a me= ssage > that we are in safe mode. >=20 When application starts with a wrong ice.pkg, the output shows: ice_load_pkg(): failed to allocate buf of size 0 for package ice_dev_init(): Failed to load the DDP package,Entering Safe Mode Segmentation fault (core dumped) I used gdb to track this issue and found it cored dump at ice_hash_init()= .=20 It is caused by the pointer *parser is set NULL. If I don't set NULL, the= output shows normally: ice_load_pkg(): failed to allocate buf of size 0 for package ice_dev_init(): Failed to load the DDP package,Entering Safe Mode ice_init_rss(): RSS is not supported in safe mode As to build failure issue, I used "if, else if" previously and didn't con= sider all cases other than "if, else if". So the test report shows: error: 'parser' may be used uninitialized in this function. I changed it = to "if, else". Thanks! Br Simei > > > > return ice_register_parser(parser, ad); } > > -- > > 1.8.3.1 >=20