Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2768468yba; Mon, 6 May 2019 11:12:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwq5Ogm65RD2l7BFyF6+LO3hbP2qG95NfPOlG+QHP59nYiVoSmZBP/wKep8UpUCU3DblsSD X-Received: by 2002:a63:e004:: with SMTP id e4mr34159329pgh.344.1557166321168; Mon, 06 May 2019 11:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557166321; cv=none; d=google.com; s=arc-20160816; b=p5k+bc4O+Oecr1wqa2AGh+pM0vOIJoWI8ib6swlMCESLx3lqzYy3ChycARp/Xw3Uqx JlPl6BLzyWidAPuTdpYTVLI77hjrPX/UbCR+Gh8lQ7ioewKT93194/AUlIZYzkk72sm6 iARhUVZ3vrLbfHVzou1nELTADax2UxlF0909yALHLwPga57yWJnF0b5lXacO45bqJVe2 lK8BJ5WZBGKp13ALAC7sDmvpnw+9imRd7MnpgygiuxByV2ahw5S9DiIgJM/YdwVJAFeM zVEQpUmdt2t+BfHaRHpg6c/w2jYJbrmKX2182dRLVILnLvwKjtsMPqei5YmoL8g4bndy Lqcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pQ5p4RP34NX2PvYVfXz5vCXoCcESk4gOGOXY8E8Q6qM=; b=RUB6+mBY8rRuvqAF/m7SyydO8iHuJZ23c6CzLZhJEWDpKZKVmDc5FE9ak+Dyi6IgIY FE3msegfi8LHdlV5U22DpRnaU4h1N0CbymAScrqTv1VlDubT3XQq7g3SGSXBguYmKsUL q0qDEIi0aWowm+odggMJEBbtaq5I8/ZqTkXtFAgYtENPrBxItitEyCOQDD9tT1oUEc1G JSu3gOZxyZq/j1L0c3aGynVYZ2j138+P1p55dyy3BBpZALokbpw7rkjPaxNclMNe+ut7 4943MFQp2MVMm96ox8heAkg8kRbjLe2Pucl7PvuZHsNKhWS9vOf/UmiAb94GFORp9Rhv xevw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cm10si14540208plb.124.2019.05.06.11.11.44; Mon, 06 May 2019 11:12:01 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbfEFSKx (ORCPT + 99 others); Mon, 6 May 2019 14:10:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58378 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbfEFSKx (ORCPT ); Mon, 6 May 2019 14:10:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B8A08A78; Mon, 6 May 2019 11:10:52 -0700 (PDT) Received: from brain-police (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 10A6C3F5AF; Mon, 6 May 2019 11:10:50 -0700 (PDT) Date: Mon, 6 May 2019 19:10:40 +0100 From: Will Deacon To: Jayachandran Chandrasekharan Nair Cc: Linus Torvalds , Jan Glauber , "catalin.marinas@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [EXT] Re: [RFC] Disable lockref on arm64 Message-ID: <20190506181039.GA2875@brain-police> References: <20190429145159.GA29076@hc> <20190502082741.GE13955@hc> <20190502231858.GB13168@dc5-eodlnx05.marvell.com> <20190506061100.GA8465@dc5-eodlnx05.marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190506061100.GA8465@dc5-eodlnx05.marvell.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 06, 2019 at 06:13:12AM +0000, Jayachandran Chandrasekharan Nair wrote: > Perhaps someone from ARM can chime in here how the cas/yield combo > is expected to work when there is contention. ThunderX2 does not > do much with the yield, but I don't expect any ARM implementation > to treat YIELD as a hint not to yield, but to get/keep exclusive > access to the last failed CAS location. Just picking up on this as "someone from ARM". The yield instruction in our implementation of cpu_relax() is *only* there as a scheduling hint to QEMU so that it can treat it as an internal scheduling hint and run some other thread; see 1baa82f48030 ("arm64: Implement cpu_relax as yield"). We can't use WFE or WFI blindly here, as it could be a long time before we see a wake-up event such as an interrupt. Our implementation of smp_cond_load_acquire() is much better for that kind of thing, but doesn't help at all for a contended CAS loop where the variable is actually changing constantly. Implementing yield in the CPU may generally be beneficial for SMT designs so that the hardware resources aren't wasted when spinning round a busy loop. For this particular discussion (i.e. lockref), however, it seems as though the cpu_relax() call is questionable to start with. Will