From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:53728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933141AbeAKTAt (ORCPT ); Thu, 11 Jan 2018 14:00:49 -0500 Date: Thu, 11 Jan 2018 21:00:45 +0200 From: Leon Romanovsky To: Bart Van Assche Cc: "dledford@redhat.com" , "jgg@mellanox.com" , "monis@mellanox.com" , "linux-rdma@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH] RDMA/rxe: Fix a race condition related to the QP error state Message-ID: <20180111190045.GE15760@mtr-leonro.local> References: <20180109192340.25702-1-bart.vanassche@wdc.com> <1515620434.3403.169.camel@redhat.com> <1515621700.3403.174.camel@redhat.com> <20180111062252.GP7368@mtr-leonro.local> <1515686552.2752.2.camel@wdc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Clx92ZfkiYIKRjnr" Content-Disposition: inline In-Reply-To: <1515686552.2752.2.camel@wdc.com> Sender: stable-owner@vger.kernel.org List-ID: --Clx92ZfkiYIKRjnr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 11, 2018 at 04:02:33PM +0000, Bart Van Assche wrote: > On Thu, 2018-01-11 at 08:22 +0200, Leon Romanovsky wrote: > > The proposed patch definitely decreases the chance of races, but it is not fixing them. > > There is a chance to have change in qp state immediately after your "if ..." check. > > Hello Leon, > > Please have a look at rxe_qp_error() and you will see that the patch I posted > is a proper fix. In the scenario you described rxe_qp_error() will trigger a > run of rxe_completer(). Bart, What am I missing? CPU1 CPU2 if (unlikely.... <--- /* move the qp to the error state */ void rxe_qp_error(struct rxe_qp *qp) { qp->req.state = QP_STATE_ERROR; qp->resp.state = QP_STATE_ERROR; qp->attr.qp_state = IB_QPS_ERR; ---> rxe_run_task(&qp->req.task, must_sched); It is more or less the same as without "if (unlikely..." Thanks > > Bart. --Clx92ZfkiYIKRjnr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkhr/r4Op1/04yqaB5GN7iDZyWKcFAlpXtF0ACgkQ5GN7iDZy WKc0ww//YtwC996gfre5P5Dlaeefo382CVhCtjaqQKjGx8AfccxmT8xKIgV0L4Sj nO2RtohuGSxZii9qEmpZg96rJBl7PxMkmwiZDPFXYuoeuBZLFqQTYG73z5VW9TiZ 3NzE7Y2FLQyYO07g09OvitMm8gaJ9+/RsmmEbMqhFbCoqYfswyF9gvQBfJWwZlzX W7HnBjC7ga56h9ewEqv4FwcGWriXNVsquAdBBCqf7U+xvstBcnRjfluXBf3Iaxl4 aOKPfmIwvPAVjOAlqjCDas9+0Nx4CPlqePXDmLxRie7vfbtArkUAZJHJLVNAtIBb 5Nv8llxzNjSPGiaXlhn0lzFpPxpfgVrQf2vCIkBOT0SoFvv0xHW0qdWk/73shcez +VeXnPc+glIemRJUsUWyycvX7TTzJNzdvcianRBU5ovg1pikYgT/XvH6KOR5ZrKZ Ek4UQzdqdU/XicvpQoGh0+UO7DJH5FM2L1oKdMtFzRmov8aqikbYkju+7ypd37cG mXA5ElEVPvt8pPsX+jed1cOsRuDZbS9MabPmS0d1wQvVO3ZDSEWhCIw8zHpf0gbP t2EaFL5fXzymX3WOfM288L1LokS8K2bnBkrJ2zlYbVPIQGR3gg5cMHR+NcgQA2Ui 2f3ksftZBghMNpZLi2NCUCTROwshaLuJOvUCAXo34Ycv7spKWIY= =XAwO -----END PGP SIGNATURE----- --Clx92ZfkiYIKRjnr--