From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0062.outbound.protection.outlook.com [104.47.38.62]) by dpdk.org (Postfix) with ESMTP id A9F9B2B92 for ; Wed, 29 Aug 2018 07:49:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9q1JJJ9l4Q+357fQ1hQDLSMx0w+FYce65nA/t6bnl08=; b=lx0q2GwTBUOBzc0NK9QWooeXD0tTAOSo7EjVQ3OEL1FE4wbvRwSmDEZV2djG32f2o4JwWhWfY9BS+HUQQ2/jDgVCaf64lH0rPMKjn5aH3InOytfPbcLt3nn+4P7yVYftasT/V9QLOWqpOO2H8cQyBDHo/WHybbWwiK4Qp/FDJnM= Received: from BYAPR07MB4950.namprd07.prod.outlook.com (52.135.238.203) by BYAPR07MB4743.namprd07.prod.outlook.com (52.135.205.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 29 Aug 2018 05:49:55 +0000 Received: from BYAPR07MB4950.namprd07.prod.outlook.com ([fe80::521:cb43:9ff3:4118]) by BYAPR07MB4950.namprd07.prod.outlook.com ([fe80::521:cb43:9ff3:4118%4]) with mapi id 15.20.1080.015; Wed, 29 Aug 2018 05:49:54 +0000 From: "Kokkilagadda, Kiran" To: Honnappa Nagarahalli , Gavin Hu , Ferruh Yigit , "Jacob, Jerin" CC: "dev@dpdk.org" , nd , Ola Liljedahl , Steve Capper Thread-Topic: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchronization Thread-Index: AQHUNUdHkUZ+sZgtUU2iOsEQID7R1KTTtAyAgAAZ24CAAT5a2YAAlHYAgACezwCAAA09+g== Date: Wed, 29 Aug 2018 05:49:54 +0000 Message-ID: References: <1533810233-7706-1-git-send-email-kkokkilagadda@caviumnetworks.com> <1534413317-644-1-git-send-email-kkokkilagadda@caviumnetworks.com> <649064d2-430c-d761-44ce-453e1a14031a@intel.com>, , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Kiran.Kokkilagadda@cavium.com; x-originating-ip: [111.93.218.67] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB4743; 6:W1D8jqB/IWdYt8w2KobK+HeQMPJ5eZfPRSXpYEZmoZ0uKGhZHMxOULs9TXcpmJQDARKJU8MoIG/Ry2fc0qdGM0uyg0RBCRmkM9QFRO43yDmcK0ahg7nWejyKLf4RIksJZF5l5s+FuHTSaZif1ciSes/ND7Wiu3xrGtRDM7esza7JZd+/39wep03/UlnqKzlStnrzIPkipUg9jfzW55swtLU8GjqsPPvguzFXE+jGzhI+PuWVVrnFHc2JAg5sYbeXLTWuQlQPrJtSakKh5piC9prEP6N2C9h0nZQ2CB40PxrNrBkDsnaeo3c/zoM1JsrKd+HiW4VqALijXgy0efKh65Ho9I7gwfeelcXws6+L+lKGUyUT5wrXFG713cRRQs6Ez66ZDmKJYK/cs+yLIsQZWub0x9i3VIREpOXBZZuCAWPJl02v3mylMcDzu0+8XurZG3MTO9spaLgGHpb9BdKFZA==; 5:ZTocgThEexL5Qq98Y/+vrAuE4jmxZi/yjAk3Q2fiI462JKbuyZQgEIrzeZ0roy8Z1YfORhOgOYkcBSSAWjcUWffAnIwCJ45XEsZYkEB1gZcv83oNaNNNScivew4xYxbvsWNrTMn083fU9r2rFG2PyfndoAPPf0EnK4cVHctpL1g=; 7:LCTGHv0+6qYKRII56ZRzvo0b4tYEnytF6th9T1EH5zRjewsxNxWVzfiC5zbSx8iAH8sDHe5F6fT/frRrmLP4Jxc1uQDwZHOKEGZOKAKOQ08phT4RNx+S6GQ8fg6AWLM52qm0ABuCEBcupOF0xbpHHgaPGUm4oOD0UQeV0+eLG+Yukj013AHcb+5gtpAQ4N8vtztT8uImKIkb7/1XWX/35Ls0wIk2+5dzAnQCSig/rUSgQEmt/p9iIpVmaHf6QA7v x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(376002)(396003)(366004)(346002)(136003)(39860400002)(13464003)(199004)(189003)(40434004)(74316002)(106356001)(7736002)(76176011)(316002)(5660300001)(6246003)(110136005)(7696005)(6436002)(6506007)(6606003)(25786009)(6636002)(99286004)(6116002)(229853002)(93886005)(3846002)(86362001)(8676002)(54906003)(4326008)(53546011)(105586002)(2900100001)(236005)(446003)(66066001)(5250100002)(19627405001)(54896002)(9686003)(33656002)(72206003)(102836004)(14454004)(186003)(53936002)(81156014)(478600001)(8936002)(55016002)(81166006)(2906002)(14444005)(97736004)(5024004)(26005)(486006)(476003)(68736007)(11346002)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4743; H:BYAPR07MB4950.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-office365-filtering-correlation-id: 1e6177bc-599c-4857-1481-08d60d733ea7 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4743; x-ms-traffictypediagnostic: BYAPR07MB4743: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699016); SRVR:BYAPR07MB4743; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4743; x-forefront-prvs: 077929D941 received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Th4jNSrBz4zCIo7WW3ngCM1AjRWrST9RPwy5Yd4YAeeE4vs4rm7GszRVIILDSJqXMaePBbU/K07WqvoKLDG5nkUU1yIBzU/qxvaMYscvXfWH80pCNF/1X337AaYAynsNjpxh5pBgdPyp9OvuXwPqCdx5yTjkONn/yGMYHtE4L6PwcHCok08xBk/tr6xV5yP83m9GC5GRe8TR3yeRo3KMOXMpew8JcSOaPrwDVBf0MeqGuLKpod07S7ChSATF7jVpHBndhcIQcNbjZtPu/yq75kBOkXHEIsVfg5YRJO3gNgICcWeR6IERA8r0BP9/5yNJh0mK8S5oTJIxqOfo2UwM+fltwf8xJgvzhFVNOkE40cI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e6177bc-599c-4857-1481-08d60d733ea7 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 05:49:54.1199 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4743 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchronization 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: Wed, 29 Aug 2018 05:49:58 -0000 Agreed. Please go a head and make the changes. You need to make same change= in kernel side also. And please use c11 ring (see rte_ring) mechanism so t= hat it won't impact other platforms like intel. We need this change just fo= r arm and ppc. ________________________________ From: Honnappa Nagarahalli Sent: Wednesday, August 29, 2018 10:29 AM To: Gavin Hu; Kokkilagadda, Kiran; Ferruh Yigit; Jacob, Jerin Cc: dev@dpdk.org; nd; Ola Liljedahl; Steve Capper Subject: RE: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchroniz= ation External Email I agree with Gavin here. Store to fifo->write and fifo->read can get hoiste= d resulting in accessing invalid buffer array entries or over writing of th= e buffer array entries. IMO, we should solve this using c11 atomics. This will also help remove the= use of =91volatile=92 from =91rte_kni_fifo=92 structure. If you want us to put together a patch with this idea, please let us know. Thank you, Honnappa From: Gavin Hu Sent: Tuesday, August 28, 2018 2:31 PM To: Kokkilagadda, Kiran ; Ferruh Yigit ; Jacob, Jerin Cc: dev@dpdk.org; Honnappa Nagarahalli ; nd <= nd@arm.com>; Ola Liljedahl ; Steve Capper Subject: RE: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchroniz= ation Assuming reader and writer may execute on different CPU's, this become stan= dard multithreaded programming. We are concerned about that update the reader pointer too early(weak orderi= ng may reorder it before reading from the slots), that means the slots are = released and may immediately overwritten by the writer then you get =93too = new=94 data and get lost of the old data. From: Kokkilagadda, Kiran > Sent: Tuesday, August 28, 2018 6:44 PM To: Gavin Hu >; Ferruh Yigit >; Jacob, Jerin > Cc: dev@dpdk.org; Honnappa Nagarahalli > Subject: Re: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchroniz= ation In this instance there won't be any problem, as until the value of fifo->wr= ite changes, this loop won't get executed. As of now we didn't see any issu= e with it and for performance reasons, we don't want to keep read barrier. ________________________________ From: Gavin Hu > Sent: Monday, August 27, 2018 9:10 PM To: Ferruh Yigit; Kokkilagadda, Kiran; Jacob, Jerin Cc: dev@dpdk.org; Honnappa Nagarahalli Subject: RE: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchroniz= ation External Email This fix is not complete, kni_fifo_get requires a read fence also, otherwis= e it probably gets stale data on a weak ordering platform. > -----Original Message----- > From: dev > On Behalf O= f Ferruh Yigit > Sent: Monday, August 27, 2018 10:08 PM > To: Kiran Kumar >; > jerin.jacob@caviumnetworks.com > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer > synchronization > > On 8/16/2018 10:55 AM, Kiran Kumar wrote: > > With existing code in kni_fifo_put, rx_q values are not being updated > > before updating fifo_write. While reading rx_q in kni_net_rx_normal, > > This is causing the sync issue on other core. So adding a write > > barrier to make sure the values being synced before updating fifo_write= . > > > > Fixes: 3fc5ca2f6352 ("kni: initial import") > > > > Signed-off-by: Kiran Kumar > > > Acked-by: Jerin Jacob > > > Acked-by: Ferruh Yigit > IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.