Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2519114ybb; Mon, 30 Mar 2020 07:43:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvdUVvw16d8CixFzcD03n4o2v3NRH0IlDPvg20xvPQQVHCnt2Vfb5sWVXqnGUwT2aod/ySQ X-Received: by 2002:a05:6808:648:: with SMTP id z8mr7969018oih.72.1585579417167; Mon, 30 Mar 2020 07:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585579417; cv=none; d=google.com; s=arc-20160816; b=TNr7655XXzUAAo8nfWsz469pYFkfZGJV7H1IOD4rR/IItfebLIri4XD5AcWb7T56wF VJUhznOJRvxOWOutlcLsuVv5pC9ctqebCvvfGImf58F0byTlIuky2CdRywKAhsUXE0SP JcwCDWOYItlqYXljeu1lZvqPms0rzmEC8z/z5+KBUV8KM/nJm27yUjJy+BrbPzC+3A+F lSKCTuRR6PIQdZWCeLeC2D2ULzWuArPBGuwJWWsGIj7HT4jkEkX8Z8hQi34I4VvCb2qm MmoA2Fsf66fuOZPap5ZCws9Mz9VwpiJcPLOZ0QQNF6bHmYa0qQdjGFVNLy/wy7LBYCpp mvAw== 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=kIizzzmSJRWVu1reXJwhmQRZxtayt+EWZssLUsIqNcc=; b=AcWU+3+eqagxtUfGbl79sXKZ3JevM3q2BuR3HMRjzrkH6aBBcvthxOhDgFvXxlOvsI NwESePmhIbiezosm2vGlE+Nv0HmiiZURjqUj9PGr11n3+liDRNNOXHuMyCR2bkItOBsL Wvs6Kb/Pk0hVCl54fgaxG19oY6XRnM6WwNDq0sPzdHWMSzxOjCUXJ4GUl7Tq//mdWw9t hGzxzwk+rcTXc5urTeFA3hwLjSaUYKj77EZNN3hhJloLIKtR6giNYPp8+u24Mpgjb/Op 1QMiNNZpP0inJgnp86CwGEOb7iFEu7FLLa7+GirlmobZIiARbfdTEsKSk72KJXpEOUaG 736A== 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 j15si6799347ots.187.2020.03.30.07.43.23; Mon, 30 Mar 2020 07:43:37 -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 S1728124AbgC3OeX (ORCPT + 99 others); Mon, 30 Mar 2020 10:34:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:29852 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbgC3OeX (ORCPT ); Mon, 30 Mar 2020 10:34:23 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02UEXoKl132301; Mon, 30 Mar 2020 10:33:52 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3020wcpua5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2020 10:33:52 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 02UEXpYi132364; Mon, 30 Mar 2020 10:33:51 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 3020wcpu4d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2020 10:33:50 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02UEW3aU031502; Mon, 30 Mar 2020 14:33:34 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma05wdc.us.ibm.com with ESMTP id 301x76hcp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2020 14:33:34 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02UEXXON55312802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Mar 2020 14:33:33 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 979FEAC059; Mon, 30 Mar 2020 14:33:33 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F0F64AC05B; Mon, 30 Mar 2020 14:33:24 +0000 (GMT) Received: from LeoBras (unknown [9.85.228.254]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 30 Mar 2020 14:33:24 +0000 (GMT) Message-ID: Subject: Re: [PATCH 1/1] ppc/crash: Skip spinlocks during crash From: Leonardo Bras To: Christophe Leroy , Peter Zijlstra , Ingo Molnar , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Enrico Weigelt , Allison Randal , Thomas Gleixner Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Date: Mon, 30 Mar 2020 11:33:15 -0300 In-Reply-To: <4759f5e9-24a6-7710-86a0-c8e45f5decb7@c-s.fr> References: <20200326222836.501404-1-leonardo@linux.ibm.com> <56965ad674071181548d5ed4fb7c8fa08061b591.camel@linux.ibm.com> <4759f5e9-24a6-7710-86a0-c8e45f5decb7@c-s.fr> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-C+Q7ijJHxQd1AYsB9q38" 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-30_01:2020-03-30,2020-03-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 suspectscore=2 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003300134 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-C+Q7ijJHxQd1AYsB9q38 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Christophe, On Sat, 2020-03-28 at 10:19 +0000, Christophe Leroy wrote: > Hi Leonardo, >=20 >=20 > > On 03/27/2020 03:51 PM, Leonardo Bras wrote: > > >=20 > > [SNIP] > > - If the lock is already free, it would change nothing, > > - Otherwise, the lock will wait. > > - Waiting cycle just got bigger. > > - Worst case scenario: running one more cycle, given lock->slock can > > turn to 0 just after checking.Could you please point where I failed to = see the performance penalty? > > (I need to get better at this :) ) >=20 > You are right that when the lock is free, it changes nothing. However=20 > when it is not, it is not just one cycle. Sorry, what I meant here is one "waiting cycle", meaning that in WCS there would be 1 extra iteration on that while. Or it would 'spin' one more time. >=20 > Here is arch_spin_lock() without your patch: >=20 > 00000440 : > 440: 39 40 00 01 li r10,1 > 444: 7d 20 18 28 lwarx r9,0,r3 > 448: 2c 09 00 00 cmpwi r9,0 > 44c: 40 82 00 10 bne 45c > 450: 7d 40 19 2d stwcx. r10,0,r3 > 454: 40 a2 ff f0 bne 444 > 458: 4c 00 01 2c isync > 45c: 2f 89 00 00 cmpwi cr7,r9,0 > 460: 4d be 00 20 bclr+ 12,4*cr7+eq > 464: 7c 21 0b 78 mr r1,r1 > 468: 81 23 00 00 lwz r9,0(r3) > 46c: 2f 89 00 00 cmpwi cr7,r9,0 > 470: 40 be ff f4 bne cr7,464 > 474: 7c 42 13 78 mr r2,r2 > 478: 7d 20 18 28 lwarx r9,0,r3 > 47c: 2c 09 00 00 cmpwi r9,0 > 480: 40 82 00 10 bne 490 > 484: 7d 40 19 2d stwcx. r10,0,r3 > 488: 40 a2 ff f0 bne 478 > 48c: 4c 00 01 2c isync > 490: 2f 89 00 00 cmpwi cr7,r9,0 > 494: 40 be ff d0 bne cr7,464 > 498: 4e 80 00 20 blr >=20 > Here is arch_spin_lock() with your patch. I enclose with =3D=3D=3D what c= omes=20 > in addition: >=20 > 00000440 : > 440: 39 40 00 01 li r10,1 > 444: 7d 20 18 28 lwarx r9,0,r3 > 448: 2c 09 00 00 cmpwi r9,0 > 44c: 40 82 00 10 bne 45c > 450: 7d 40 19 2d stwcx. r10,0,r3 > 454: 40 a2 ff f0 bne 444 > 458: 4c 00 01 2c isync > 45c: 2f 89 00 00 cmpwi cr7,r9,0 > 460: 4d be 00 20 bclr+ 12,4*cr7+eq > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > 464: 3d 40 00 00 lis r10,0 > 466: R_PPC_ADDR16_HA crash_skip_spinlock > 468: 39 4a 00 00 addi r10,r10,0 > 46a: R_PPC_ADDR16_LO crash_skip_spinlock > 46c: 39 00 00 01 li r8,1 > 470: 89 2a 00 00 lbz r9,0(r10) > 474: 2f 89 00 00 cmpwi cr7,r9,0 > 478: 4c 9e 00 20 bnelr cr7 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > 47c: 7c 21 0b 78 mr r1,r1 > 480: 81 23 00 00 lwz r9,0(r3) > 484: 2f 89 00 00 cmpwi cr7,r9,0 > 488: 40 be ff f4 bne cr7,47c > 48c: 7c 42 13 78 mr r2,r2 > 490: 7d 20 18 28 lwarx r9,0,r3 > 494: 2c 09 00 00 cmpwi r9,0 > 498: 40 82 00 10 bne 4a8 > 49c: 7d 00 19 2d stwcx. r8,0,r3 > 4a0: 40 a2 ff f0 bne 490 > 4a4: 4c 00 01 2c isync > 4a8: 2f 89 00 00 cmpwi cr7,r9,0 > 4ac: 40 be ff c4 bne cr7,470 > 4b0: 4e 80 00 20 blr >=20 >=20 > Christophe I agree. When there is waiting, it will usually add some time to it. Accounting that spinlocks are widely used, it will cause a slowdown in the whole system. Thanks for the feedback, Best regards, --=-C+Q7ijJHxQd1AYsB9q38 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEMdeUgIzgjf6YmUyOlQYWtz9SttQFAl6CAysACgkQlQYWtz9S ttRBfhAAp4/gTVPb17bMlgO70B7405SwimpQ9SVhvDfp86mRUHzoqk1nhSLVgD3U rWAzt9xF01uuM9nZDXGGsEb56vUwmYtz01FNd5ijZXsyS2zu/Wnld8CvKvn9Y4oA v+i554fXWHxxg5BKB1dqViF3ISdleh5Qi1QkAYhrbguF46KIFDAVNvzMW3nOg7Jm M9Jou/n7ci/G3AVllzG8DtFEcBSxUW/u14+FUGQIXyT8VeU18hy28uTeh8jwsV24 7wlPvjZ+zkSTwU+85C79IYv2bVxEZwLdi59OcNPGGaGxWVQuSjheuURy3qsO1Hwi c2BTgDd8Q2cUYGPl7Ax42+aVJAFnkeRkwBaM4ndEasMWUXNaP6X/g1allm9yZcyD 4eXCFvO71qUExwIEs44mjQmt9mdMcAdeyIApgy5FdqgMqp5d8abpc8TLaq6+mrSs FFxzs7vEl8NGDSIaCwAF4Mgp8vKDScGuz37nA+P7RqbBPU0S1Ogaw8Vniz8T2uaB OX1FibnFOw1US3rhUpgiARz7aeDZWUXNp4InFrwWuaT/0CueooMhja3A19xF9pBA 79+68WNH6QCDZCikm5GFwjyIQ90I+Kc+69yeK9CYMoqzqVgMHBtEgDDCkfTijkha s1WNvXKtppKGto6Pidx0IW1heLZTLh1u9+UyLGEGMLHaS7BVv7Y= =g7r1 -----END PGP SIGNATURE----- --=-C+Q7ijJHxQd1AYsB9q38--