Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp2423149pja; Thu, 26 Mar 2020 15:07:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtvQ0e683xCbWBu4Rj02hhJHR0kiaCP+7YyURCUfmakQ1FBaN7hFrnjmhWwzPaeJTB9h/LO X-Received: by 2002:aca:c4c5:: with SMTP id u188mr1833309oif.139.1585260436902; Thu, 26 Mar 2020 15:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585260436; cv=none; d=google.com; s=arc-20160816; b=Zz7dbkg7o7PLUMPV6++eHBUbXXMESzRKBPGpQoGW/o+ORtFuhLv9MWvdRS8wS23TMj TLiK5zjT6PyrJqU4x2XFOQSIc/4hqIXka3FtMMYTJrF8etF2H3zZAuy72neovU7hAH+U 5N06c6j3zvV2HN+xs0K6mUVdPpgUsMYk29XAgYW15OdbkqmT1Bcy4Glyuqf/6qx0G3zt Sf6U8rEnj8o3DpkHN5WSNDte/Y0tZIjDW+X/zH297ZJnnYPOrUa9wefWh8KopBaD4Dw2 fCHD0r6T5LWh4YZVc6/kPdEE+D53zRhdH1Jk0XhtQW8sL6PSlvk3Cxc/RvkFphMUi+s0 GEcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=GWVsgm89hdwvRfQuL2VuIV/fWyqOWBdX9yP0Irvi6G8=; b=0DYlsdRmw2iLYVA4YRBbeLU0XZIcTQXkkjcxAkAd87MecdFAIOtZdFiee/1/d5CNlq XsViDiabqOQ2NBAR9svcvPqxvXIQAvqi7AHuD/0U+bS1EDgnizg20+nLJfM8ium8dVs3 cb76KGxnRCHOpmNXfdt8UvY4OO9iZcCnOppqiqUNYh11T1hrrRbFi9KJxr4g3r+EXBzF S/HhZG1rZ5YJSJAkOvr0XKkUwrsQNuXFYazFiGAH0kCCF8Kd7nWG2LfyCj/ndEiYU9sa 3UZ1zeJUDiXTP9kU6Gux7a2vZzhbue3KcoChCBc7nqGkAj4RYhYmhMQPz1d71Yc8jT5F zHsQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si1674882oto.72.2020.03.26.15.07.03; Thu, 26 Mar 2020 15:07:16 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727505AbgCZWFk (ORCPT + 99 others); Thu, 26 Mar 2020 18:05:40 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51048 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbgCZWFk (ORCPT ); Thu, 26 Mar 2020 18:05:40 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02QM4pYo003294; Thu, 26 Mar 2020 18:05:22 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 300jeununj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Mar 2020 18:05:22 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02QM3AUC020255; Thu, 26 Mar 2020 22:05:21 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma02dal.us.ibm.com with ESMTP id 2ywaw2ra6v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Mar 2020 22:05:20 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02QM5KIb11076308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Mar 2020 22:05:20 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18E20AC311; Thu, 26 Mar 2020 22:05:20 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BCBDAC2E7; Thu, 26 Mar 2020 22:05:11 +0000 (GMT) Received: from LeoBras (unknown [9.85.162.45]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 26 Mar 2020 22:05:10 +0000 (GMT) Message-ID: Subject: Re: [RFC PATCH 1/1] ppc/smp: Replace unnecessary 'while' by 'if' From: Leonardo Bras To: Paul Mackerras Cc: Benjamin Herrenschmidt , Michael Ellerman , Allison Randal , Greg Kroah-Hartman , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Date: Thu, 26 Mar 2020 19:05:03 -0300 In-Reply-To: <20200326214005.GB9894@blackberry> References: <20200326203752.497029-1-leonardo@linux.ibm.com> <20200326214005.GB9894@blackberry> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-GTdlyedGwk3mGYQKKQZt" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-26_13:2020-03-26,2020-03-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 mlxlogscore=838 bulkscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 spamscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003260160 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-GTdlyedGwk3mGYQKKQZt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2020-03-27 at 08:40 +1100, Paul Mackerras wrote: > On Thu, Mar 26, 2020 at 05:37:52PM -0300, Leonardo Bras wrote: > > spin_until_cond() will wait until nmi_ipi_busy =3D=3D false, and > > nmi_ipi_lock_start() does not seem to change nmi_ipi_busy, so there is > > no way this while will ever repeat. > >=20 > > Replace this 'while' by an 'if', so it does not look like it can repeat= . >=20 > Nack, it can repeat. The scenario is that cpu A is in this code, > inside spin_until_cond(); cpu B has previously set nmi_ipi_busy, and > cpu C is also waiting for nmi_ipi_busy to be cleared, like cpu A. > When cpu B clears nmi_ipi_busy, both cpu A and cpu C will see that and > will race inside nmi_ipi_lock_start(). One of them, say cpu C, will > take the lock and proceed to set nmi_ipi_busy and then call > nmi_ipi_unlock(). Then the other cpu (cpu A) will then take the lock > and return from nmi_ipi_lock_start() and find nmi_ipi_busy =3D=3D true. > At that point it needs to go through the while loop body once more. >=20 > Paul. Ok, got it. Thanks for explaining Paul! --=-GTdlyedGwk3mGYQKKQZt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEMdeUgIzgjf6YmUyOlQYWtz9SttQFAl59JxAACgkQlQYWtz9S ttTSdRAAttveHAUp1FuyI8cjRY3YA64LGrCYQ/GJZfAZljGAMyg78+BO1orF0p7b n+wYBDvQzqmLMgL5fUxeHG+CQzPX7unA/9n+rn7y4j+BVZbupjLHOnPXswoDda3Y Ycs5eFcEJ2d5Fs0psXJs/aOVtF6cd8uKNzdpk0tVGM3VMkoB509DtJqdkjY96n1g Oi7+eDKF+yUNIxmOjEeTaJwR9fSrzLRJhdnLLpOmR0/42QvOcGeh8q3p2qtCyfgo H6qEXVCq5E1nYLGuvJskD46vaRRXGZ29myCPzFDTUpaP5JMH36sUw4Ei6UjNgz8x DhXNqoqSKQ4/mP91fMXgfyBGER2l4f4dTn1fmkXRC6IAt49XIFzRTVHf7GxS3i2z jHQQHrkWmCnFeRjzbGZDZUeNU/XmNMXKponwH7Q2KvPmtiaG9YDsPnB5cKGfFyKN uOGH0fjq1yHDq3O4epERX+o+2qTxKcEUQOakkQ4chpJ6eC/EgM2KPEwadZdZ1BAf DQM4nCzsPQP+zptJO+LjJqDjZ1JXBwoeJYfPJBfB8pAw8VgvIXcnXVfHwoSH7WGf 1JRmT583BLGzc3cqD89kyzZ2NbL+XEGNTWcEAEHzg6Nf+2t4AQQY3T7U4Cluj2Fl cXrBonqlCQPiR7ShKkwkYgQ7ZuYeuV1JdKsDjVXy85WBnxcAugI= =iE5j -----END PGP SIGNATURE----- --=-GTdlyedGwk3mGYQKKQZt--