Received: by 10.213.65.68 with SMTP id h4csp639268imn; Wed, 4 Apr 2018 04:55:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Wz1MTJXdBfyW5L2Bo0vBn3AzjzPNcI3L/9Xv/+Zbvh6UOnfanV8S7wt1rL4yxlFlbTM5M X-Received: by 10.98.217.85 with SMTP id s82mr13648478pfg.208.1522842959026; Wed, 04 Apr 2018 04:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522842958; cv=none; d=google.com; s=arc-20160816; b=ZQoYe+O1GOPGCWvS1oqbaclQtuGRUsaQvxpAFWAjmNiAmQzVoBkcbw3aI0xw3QmC88 iwfHX75FEpOIq5xbqx2Ib7jXNatuPOTUvnJ+1RyPBHzABvschmDrRQAFcgEFEtxFcYwS MpFEtqb4wl6IZAhNoSwb8FIfPZBPUvM+4MN1YFkLqo/B98MKoHr7XdbVwXV2/HsJeM/1 1/vVrYOamOO7q2oUxVBwvqxBlmCE47q6ZYQN5zIrk9HZymdPZRkocIhBImepSejJwGng 6NWOFgeK193zFm6w6jlFXzFTVPyOtEvfG2w4j03sUFqGTyWdZsFugfzMpyxxG0RO38N/ KR+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=2bK7GFx6npx/TYcXQ5yvXVYvLldGEsfz+O/vG95O+cA=; b=pxTD58yb06kCKDxQPO5X2HAOl0cGazmxKCDdB2mWVG1qOVDgqrOsj+fTAu+45XcYpt 7Tk9FkfLnMV/i9YDEXI/jwmefJp5lak11ReVIS4okB1YC7yiQD5H2AXdRQqGV9YxhV01 +TL7lJ3zYATcAmSNobeguH0YHEHDVmyh6qK2FydluYtKGZqprlqVH/w893m10kaDA8Ls 20iYNMbqxX6AB/ytTsqO7Ih8enTX5cIlRhel7BLyJQozk6lzpLWhJcrvSNY6if220C9K Cm29jD3A7V+IjS98OKBOBsnn+OQ3Iua1qTxurEFmy3h9hKDj604Gob9A1L4QD2WBzEjv 56qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=d+hzOxq5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si2784441pll.726.2018.04.04.04.55.44; Wed, 04 Apr 2018 04:55:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=d+hzOxq5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751613AbeDDLy2 (ORCPT + 99 others); Wed, 4 Apr 2018 07:54:28 -0400 Received: from mail-co1nam03on0048.outbound.protection.outlook.com ([104.47.40.48]:34499 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751244AbeDDLy0 (ORCPT ); Wed, 4 Apr 2018 07:54:26 -0400 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; bh=2bK7GFx6npx/TYcXQ5yvXVYvLldGEsfz+O/vG95O+cA=; b=d+hzOxq5NvLYpQOJsF/oNAnFoIYhCCGheGG7OMLMyNMx3y7FolSmwdFQ5hCwwBkG8QaUdVf7g8FKgNRWkURvtSCHmJRtIpZrn3TrVBeiZT49+WqHIzZ1OYw4MRopm9Hb8i0fY+AxwESK6wW9OaUw4zvgrLcgwQDu8Usvu/RXddM= Received: from CY1PR0701MB2012.namprd07.prod.outlook.com (10.163.142.11) by CY1PR0701MB2105.namprd07.prod.outlook.com (10.163.142.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Wed, 4 Apr 2018 11:54:23 +0000 Received: from CY1PR0701MB2012.namprd07.prod.outlook.com ([fe80::4406:494:48de:6224]) by CY1PR0701MB2012.namprd07.prod.outlook.com ([fe80::4406:494:48de:6224%13]) with mapi id 15.20.0631.013; Wed, 4 Apr 2018 11:54:22 +0000 From: "Kalderon, Michal" To: Jason Gunthorpe CC: Sinan Kaya , "linux-rdma@vger.kernel.org" , "timur@codeaurora.org" , "sulrich@codeaurora.org" , "linux-arm-msm@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "Elior, Ariel" , Doug Ledford , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers on weakly-ordered archs #2 Thread-Topic: [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers on weakly-ordered archs #2 Thread-Index: AQHTwfqdtrypC3mzl0CHfKiVN7XDyaPuY1aAgABUiCCAANHuAIABCDAA Date: Wed, 4 Apr 2018 11:54:22 +0000 Message-ID: References: <1521736009-23387-1-git-send-email-okaya@codeaurora.org> <1521736009-23387-4-git-send-email-okaya@codeaurora.org> <20180403200348.GB21167@ziepe.ca> In-Reply-To: <20180403200348.GB21167@ziepe.ca> 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=Michal.Kalderon@cavium.com; x-originating-ip: [31.168.140.228] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY1PR0701MB2105;7:xsifjaAVW1MVkhWvqLg4nnehTEsFgNjGtCo4bK9atXircXrOSwS6k4bdYkGGeInXoqMqTxyWRayUT8bsC/i0afFWD3q6LvsgbbrkLa5cUmhxcrn/A6/sgJDv9EzjApnidKt9yDH+/PMoAPKcrH/9AeYQeyRl/KT2noX01uQse8KbJr/tvLX76Iwu62/WUd8YE1Jlu3OUUJ+1QNnjhaOje3cZFn/FzjtbI1OII6FZTkXuG/HyzSxeU1JvtJCXqBEZ x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(396003)(39860400002)(346002)(376002)(366004)(39380400002)(189003)(199004)(11346002)(8676002)(5660300001)(59450400001)(26005)(97736004)(186003)(99286004)(106356001)(102836004)(476003)(3846002)(53546011)(6506007)(6916009)(76176011)(486006)(7696005)(2906002)(6116002)(6246003)(5250100002)(3660700001)(3280700002)(86362001)(446003)(4326008)(81156014)(229853002)(74316002)(305945005)(53936002)(105586002)(6436002)(66066001)(25786009)(81166006)(68736007)(9686003)(7736002)(33656002)(55016002)(8936002)(14454004)(72206003)(54906003)(93886005)(2900100001)(478600001)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB2105;H:CY1PR0701MB2012.namprd07.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-office365-filtering-correlation-id: 73d7d393-d50a-4415-7fbd-08d59a22ce94 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:CY1PR0701MB2105; x-ms-traffictypediagnostic: CY1PR0701MB2105: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(258649278758335)(100405760836317); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011);SRVR:CY1PR0701MB2105;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB2105; x-forefront-prvs: 0632519F33 received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: zqVa5WDbMvYXe7Kf7tT1SG+2Q4ciU/tNr0ZICVynJMjNA7T4l8AweCetAMVZNTocsE5s3Peu3hBqPQcq1IbaEiEyeW5oB63L9TfSv69PTN7TKTs9o2Ty8/dM2WfR/bDIxM4rPoSIrHUFv/NDMBCnf6lDtGuG0yZHB04oUmTwK3/OIAnno0snkt9piLC4jjLUyxaUK42at5vv5JR2CcKTa7HQxqU2lAcypXMlJcv/tAMIG/0MsPG5Uzwwp4bOAq1zpykN4jtZ3iZFhZfnKfCkouumLS/FprZnOR+bENPGdXfqWr8iZzkTSEEnRqws96ulYcTHTi4Qm7wfSRKhOKmL2ynuBZi9WsrGDy0dqFUyl0E24R2bm81xmWOPPZP7F9RpiJEbia8fJisi6Ehe+IHYrOYxxKbJHlDXBb8Jg4K2mYk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73d7d393-d50a-4415-7fbd-08d59a22ce94 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2018 11:54:22.7572 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB2105 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Jason Gunthorpe [mailto:jgg@ziepe.ca] > Sent: Tuesday, April 03, 2018 11:04 PM >=20 > On Tue, Apr 03, 2018 at 07:42:28AM +0000, Kalderon, Michal wrote: > > > From: Sinan Kaya [mailto:okaya@codeaurora.org] > > > Sent: Tuesday, April 03, 2018 5:30 AM > > > To: linux-rdma@vger.kernel.org; timur@codeaurora.org; > > > sulrich@codeaurora.org > > > Cc: linux-arm-msm@vger.kernel.org; > > > linux-arm-kernel@lists.infradead.org; > > > Kalderon, Michal ; Elior, Ariel > > > ; Doug Ledford ; Jason > > > Gunthorpe ; linux-kernel@vger.kernel.org > > > Subject: Re: [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers > > > on weakly-ordered archs #2 > > > > > > On 3/22/2018 12:26 PM, Sinan Kaya wrote: > > > > @@ -860,7 +860,7 @@ static void doorbell_cq(struct qedr_cq *cq, > > > > u32 > > > cons, u8 flags) > > > > wmb(); > > > > cq->db.data.agg_flags =3D flags; > > > > cq->db.data.value =3D cpu_to_le32(cons); > > > > - writeq(cq->db.raw, cq->db_addr); > > > > + writeq_relaxed(cq->db.raw, cq->db_addr); > > > > > > Given the direction to get rid of wmb() in front of writeX() > > > functions, I have been reviewing this code. Under normal > > > circumstances, I can get rid of all > > > wmb() as follows. > > > > > > However, I started having my doubts now. Are these wmb() used as a > > > SMP barrier too? > > > I can't find any smp_Xmb() in drivers/infiniband/hw/qedr directory. > > > > Your doubts are in place. You initial patch series modified writel to > > writel_relaxed Simply removing the wmb is dangerous. The wmb before > > writel are used to make sure the HW observes the changes in memory > > before we trigger the doorbell. Smp barriers here wouldn't suffice, as > > on a single processor. we still need to make sure memory is updated and > not remained in cache when HW accesses it. > > Reviewing the qedr barriers, I can find places where this may have not > > been necessary, But definitely you can't simply remove this wmb barrier= s. >=20 > As Sinan said, the consensus is that wmb();writel(); is redundant if the = only > purpose of the wmb is to order DMA and system memory. >=20 > So can you review these patches on that basis please? Is the WMB doing > something else, eg SMP related? If yes, please send a patch adding > appropriate comments. Thanks Sinan and Jason for the references and explanations, I've reviewed t= he wmb usages in qedr and am about to send a patch that replaces two of them with = smp_wmb and completely removes two of them that given your explanation, turned out = to be redundant, thanks. >=20 > Thanks, > Jason