Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752059AbdFNKnY (ORCPT ); Wed, 14 Jun 2017 06:43:24 -0400 Received: from mail-ve1eur01on0056.outbound.protection.outlook.com ([104.47.1.56]:23264 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750728AbdFNKnV (ORCPT ); Wed, 14 Jun 2017 06:43:21 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Date: Wed, 14 Jun 2017 11:42:30 +0100 From: Mark Rutland To: Will Deacon Cc: John Garry , Shaokun Zhang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, anurup.m@huawei.com, tanxiaojun@huawei.com, xuwei5@hisilicon.com, sanil.kumar@hisilicon.com, gabriele.paoloni@huawei.com, shiju.jose@huawei.com, huangdaode@hisilicon.com, linuxarm@huawei.com, dikshit.n@huawei.com, shyju.pv@huawei.com, anurupvasu@gmail.com Subject: Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon Djtag driver Message-ID: <20170614104230.GC6085@leverpostej> References: <1495457312-237127-1-git-send-email-zhangshaokun@hisilicon.com> <20170608163519.GA19643@leverpostej> <8666a0fa-126d-e4a3-ac4b-7962f5d79942@huawei.com> <20170609143050.GM13955@arm.com> <0fbf57f0-9ff7-4fd4-07c7-c5e86028a7d2@huawei.com> <20170614100658.GE16190@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170614100658.GE16190@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: HE1P191CA0008.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::18) To AM5PR0802MB2387.eurprd08.prod.outlook.com (2603:10a6:203:9d::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4700b706-4844-4cb8-0f30-08d4b3122c09 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:AM5PR0802MB2387; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0802MB2387;3:XeYYMyg746biLoCdd/alb6l5rI665y5c5VjCaIfJn5kJQgcJeqS1/KqxWhTbPlOs5jo2cglfSPKmVuQSmPgBHW2F+UhNQ9tUTvLzIQgRLFky4rrrjgRWmJzV9iiFSWfowXrZRkL6zKOhq/c03Nm+I9E4Ckirc9+zT6SMtAQ64bQZkc+keyVjbQ2Gqc/H/ccEhFS0wUbMMxKTu2efjIJ4tJKNwguKXhwH8te/bSMDS3aA8bpI2knM5wvN3CjD9PRRJQarh92fBy1b8X3TfHYxWrCjIvD6L587c/NcdgcXe1kFBKe3ZZHPh9rP8ZSU/nTcqHdmyS9o2zLES8inYV4PpFisAbfunGLSRlzz+sNA4Dw=;25:Wi+ZPwENN8sFaRgfogK2ZvM8xc79pXNEgFcoATEnXelruo068h2aTFtgj5ozwlE0T4W4rc0kcy+4CAG0Z5j3DW64FdLgFzhDFU+hauh9AgL+S8d7ITM5ycLEB+wrH5RmJCM3g5uSphxFADes6BhrKkFtpVO2/dqnfoWpqjYanjGl+dez2fE65djfsdbtahRZaV3L8+SnlHlbwfPnHTlKUZLPu+XLs9tXRdUJ4Ky/F8FUQC9UGIfhDj3Z+2oferd5yuSdqLeYd1KVrHl9DjEDiBaHh0llTEDnLbWuppZhVndsNF19kTSYn9cQVZ1WFyCGPNaNP0YHP9sebBUpui4HLbOmsjptbYPlMNkHcaENFAi2GDsOeOhiYRqpfpMUDp4TmkBqRoB0v51mM/Ic4dO6LdmkM4Jn7TqPy2Yzg7eeeavyGTyGV195TuF+8coBZm6Xv067FJHTpTd05Zn85Y+Mglm0ereE+6qw7Bb2t1YRQkk= X-MS-TrafficTypeDiagnostic: AM5PR0802MB2387: X-Microsoft-Exchange-Diagnostics: 1;AM5PR0802MB2387;31:DzRrngYAw+DXY2g1CaN80zQjBhXVfunez94xbtA2HOWvaB0cE3AXQQ7NWndI0TlVVdcMpAasHZNIH9G874OMYdJCE/zYomG980JbbCPTgRIrSloaYSAQQ+HeOjKAU9eVOqInXuoqGn1apcpYv7+OIRnRFiTvnGMARVATiiEZbme/hf1qmGtFenkRpz4Geyv9moQDXyz8jRGe957sreK88y0gHdxlIAcSDKvObdcRdFs=;20:dswFcSC3nlEl8CjPZAdCheBVZ3tWbJH2ZHH1ULSC7fPoYfgNgrPVYuouQu0ISoCgigV9p+2z4yKYSqzwc/nmenLvceGqgEvjKRA+/KNUikw6jDi15YHNOyhKojO6PIHTILi9kWWHRaiyrWb/FhFgCPh+PzHphlBvRLGktNILwwApGds25j6U8fvGFemy8M5aq9zzJXiv03334EkXjGf+dvLIMcL1CDb4+cG8xcAfWwjElS8nxS+jbrIuEl1tB7UmyOuZhUwTU7y0HkANA4crHM8/4fZOR2me1Gzp8nZ4AAtcBsInwJ7Kn9yvhwpA4Se6RZQa17rMKMaSSWD6lz4rsC5k4I+0KYKqtgjjO+aR48VColCuNMZuQtKyqIkGZfpAHX58NW8KixK47/CNmlVPQixwWdjvxA0l1+4B55TmKTVtbt4a1rQsBMA/4lRI5zi9AwVSao8SowhetPhszm1i8gcwSSOjPoj6g4mYcBMsF0hLReV7mALeYI+rk6F+ngBF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:AM5PR0802MB2387;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:AM5PR0802MB2387; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM5PR0802MB2387;4:yQ1hkdjr0v3y3205zrX7eNN5f09r1H0sPCfjroWB?= =?us-ascii?Q?t33SoobdNKhfdEi1gyzwlR2TrMUJ/JDCj4cN8N1IUp68U9ZkCuUvTwgbor+g?= =?us-ascii?Q?DkRUS+qgzr+csyl+ixLFcDXCFMNoqbl9usufApJ4yBdGQjcK2fHAAQipZJk6?= =?us-ascii?Q?zQl1WBDRfMKdBoN7RqDi2JKN8QRguyS8v6J8dLfGJCVLyHpo80VJnDgKkOnj?= =?us-ascii?Q?amzIKKuTbdlFrzsessyvGXJxM/CjDcUjgOc8uiwQEmIwbJgM26jx9DlF/AHi?= =?us-ascii?Q?vOkF99es/MMw1umDTViNqSVvwjA/mZ2ZgyYPr+oB9ACcNJOkDZManhbfv/iP?= =?us-ascii?Q?+s9HHTqTJCglbnNkFJQjXpLMc/MxV/tFNbK/96YCh1ewZlTADCQqnQ9v9ssI?= =?us-ascii?Q?wj2TLNXJR81Y4aNZpwfStZKHXcEhImMMI/iMc6RkltIxkik7HGMEYIql0f5W?= =?us-ascii?Q?Ni+C/YrRXVkjZTwvmVtSaOaySBH9pLeM5ThnjxO1V8edHZda0xGaEyFX8YbL?= =?us-ascii?Q?hlxB11yfa4UU4oGhPQUebgQA6yYFaD9uVVqYx7IsP+8BLHdjyx0i0+/MPL+z?= =?us-ascii?Q?Ys65fAEr3Ok7bKsrInUQnyRrOVWOWKxJ8CaB8m5MJxF5L9/VmacwW9Tk7sPp?= =?us-ascii?Q?YILw/kE13pYkGzjOsUpj7As0JNFD+z85Lja68VkhEV4YuBBXC9dgJcmdOb/k?= =?us-ascii?Q?wbkbZeaGGCerbg27arGqY9kinus4+ZKo0mKvMdVm/oGQaFRQC0POZQiy7C8F?= =?us-ascii?Q?+GPqjymLOK8aoBvQW793fB33habnaew/qhp9fa9VQ093/D2Mg6OUjuloZs2r?= =?us-ascii?Q?NZ4KfuWc/B6Bs9GSLEk4t2fv1eCZfud8ecESCmz9/gx5WplO4y18gGrdt2et?= =?us-ascii?Q?unBZfsOpdFrYLVuUxiYhkP07KAWSXuiDZkhCIardeOgbGEVrzkjNgaAyaWrr?= =?us-ascii?Q?6G0BoSyCir1gXYNzNvxZ9OzQOPA6HU/zYk+kTgbv6JD5zvPxp7XNXK5tCK1a?= =?us-ascii?Q?2UyW64KDY6kIs0Wq8cOJ6Nyc3uYDcTACA0zkuEUcEH8bfWSqOZVtOcgCu1V8?= =?us-ascii?Q?GB9VMyzIoHUYIU2UdVYg06aZ8DFm0hh8BXeGweByi3ymZ2NgK6tFCv+2dP8k?= =?us-ascii?Q?bj8+vUcHlcB4a7hbmbf7W1UVdvZxKFWN1nav1OxEwpv7MXUeK6GnzA=3D=3D?= X-Forefront-PRVS: 033857D0BD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39400400002)(39410400002)(39860400002)(39450400003)(39840400002)(24454002)(2950100002)(86362001)(6636002)(6666003)(4001350100001)(6116002)(50986999)(3846002)(5660300001)(33656002)(189998001)(42186005)(54356999)(76176999)(47776003)(7416002)(53936002)(93886004)(6246003)(38730400002)(110136004)(305945005)(72206003)(66066001)(7736002)(55016002)(9686003)(54906002)(33716001)(25786009)(4326008)(478600001)(6862004)(6496005)(2906002)(83506001)(229853002)(8746002)(81166006)(50466002)(8676002)(23726003)(5890100001)(1076002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0802MB2387;H:leverpostej;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM5PR0802MB2387;23:+TlRlkNrLeorp/iRGyA7bpoXy341oHg0rHOpS32?= =?us-ascii?Q?lbxI4Wt772y5uEz7PwrylSE6/NfPoXqGWx432OkWKvlW1m43IxeJhRML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DbD13AOY5cTnSntzxuF2+0JbZoLjFr6i5PBo8hMw2+J40iShaq9JKzvospDLFUZm+YhlMtonuYEshXIRAeXQ6mVTltQmDmXQckwanxG;24:uGDK92/GmRkXwaPOgg/PVVCkyicWUEOV6fZDqH8fQSKqR2P60B25vFuqUCaBcF1F1s84ZV94VEPGFQ+q6k96Tj8R0z8au709KxgIGLXoKqQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0802MB2387;7:vstfoSGF3+LXUE4W044FI6YVTrtlzFH90594qBxW9fXlpaqxbV9olkksiXFGhPvhSAKXBVqO+ezjxJXxIYWQPZxGPcce+PEaIXgUCR20NSRlU0Z4g1sIlylI72avRJalTCOwVg2NMFOOe2t9PghGfnU62eWIzdJX0/LzTf4dxDSKlzSgrrCoYx4G+DlauIjEOrc+zLET9paKLYWFw4a3gEWEayct/ArwsA/iYbkTvOfupHhRg3b8CiDWvga26rgD7S/wjK2OAJi/wkHmQ3cIuOsdc7vveere7gJmxLnK3d3Waj3+hLw1QcjMHnAUvxOCIXfb4sQhd+EJlYbdYynTjaW6mMNhN29RjJMdcYdook8ZYIKD9DgKcHfPMRjVIbayrRHBxYhXiqcIQBT/bIEUepm6E5ycrWVoW8CylzRzFr/CKA5/6BkchDp7B6WdWzq1BfJ/GtTNqExWSSIObK5TA1KqaIq1UKJ0BiehotLrGdtibG/jwthEhZpdJQr7q6As4HBNUfjwviCDnBEuEs1p99CraNHP5NeSRPAlZKF1DMGtQD4d4DfmY1bqWZD8DNzAQ2D3agGIJNpHL69MQ8ot7WV+T7AmYHfm00ZIQWcsYXCec0o/+qRKVcK1GsKZKzh5BwYOCGb343fV98HX0LoRvnH9D72bcgxqsYtCHpizKVqmsF2yGKSQznxfDiiwcrDaP7fArgI9jQ9r9QWWyhqLO51GFYFS5eLMbiOXDixyV0GWJ8fW4qxekes9KoMxguCKQI6SjvRQ7oGy8CC5RlNtD3KiL2ROfby749vfdcIiiMs= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2017 10:43:17.7151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2387 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5EAhXd5011866 Content-Length: 1613 Lines: 48 On Wed, Jun 14, 2017 at 11:06:58AM +0100, Will Deacon wrote: > Apologies, I misunderstood your algorithm (I thought step (a) was on one CPU > and step (b) was on another). Still, I don't understand the need for the > timeout. If you instead read back the flag immediately, wouldn't it still > work? e.g. > > > lock: > Readl_relaxed flag > if (locked) > goto lock; > > Writel_relaxed unique ID to flag > Readl flag > if (locked by somebody else) > goto lock; > > > > unlock: > Writel unlocked value to flag > > > Given that we're dealing with iomem, I think it will work, but I could be > missing something obvious. Don't we have the race below where both threads can enter the critical section? // flag f initial zero (unlocked) // t1, flag 1 // t2, flag 2 readl(f); // reads 0 l = readl(f); // reads 0 writel(1, f); readl(f); // reads 1 writel(2, f); readl(f) // reads 2 Thanks, Mark. IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please 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.