Received: by 10.213.65.68 with SMTP id h4csp541822imn; Fri, 16 Mar 2018 10:56:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELupg0aZS0BWgcGo1vLUqSlPsXzSwN/fmSvkwFIbZMKvIE/y9tS68RqnsDJ4dkkq5TqLZiDA X-Received: by 2002:a17:902:28e3:: with SMTP id f90-v6mr3142486plb.355.1521222981382; Fri, 16 Mar 2018 10:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521222981; cv=none; d=google.com; s=arc-20160816; b=0CdkVSe3vG9GlBLBgUSS5UQIJAFgTY4ELYaCvzrie9PAF7baY0ESTul6gxiS9HzyAW zyLqqY8ushBtxHAEup/Jm+Ldf9mY7zK8eodD6oiNg0pK+y4S4nipWri3JQcxemeEOon+ nrq4OvRjubNtbfk6+JaY/sNe9jB5bWEINfT1GA3WSQ91XTBs3nEPkRtBMpRjoIFBFhL8 kHrMSOwZINEtDizfFRHXlrr6U9hUuYHEifjpHVEwkNBBSKu+X3HjQprsJptCTQoudLCD sUheu+tt9ysTsScyH5HDL92DeKoN0+y0gdU3us1yRDLrTbTP5EqB1Y/w2aZcbm6N3wm5 8WkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=244LQuCL9FAggeMFmuwz0dFo9FC0ZwhEh1/s8hLXwmY=; b=BVLkR7iLadXTlZeJbaJ24lHWq5+HP/zI2QczVjLK4tV72mPItWh+02jmrBi7453FXd TtiSE70FFW4KcoxbP4thTkadYtHXI+Z/YzspTMq15OEGKs1aY3hbLLFu5xP6qra6xBM2 GTbYVDk8B09s17naxShhbXfkC1OcsbdFl9ndAZmfhuBuYSE0kOvnNEnPETUV6Z6sW1gG v43VAjfKLtC8S5uFqllRTiHf/qbiSlY59KQ9KxhR7bIH2Zd5Z9BSfNftwfCeDLbc4UrS JbnTNy1zp0h4MGeWVHFJkGn3SLhBo/Ag9zbJMC2FuOZJzv7OxCPQFrOz5PT+PQrd8hq5 Sv7w== 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=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba10-v6si6422498plb.5.2018.03.16.10.56.06; Fri, 16 Mar 2018 10:56:21 -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=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbeCPRzC (ORCPT + 99 others); Fri, 16 Mar 2018 13:55:02 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:60860 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751069AbeCPRzB (ORCPT ); Fri, 16 Mar 2018 13:55:01 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 0CDDE24E0696; Fri, 16 Mar 2018 10:55:01 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id EEA213E6B; Fri, 16 Mar 2018 10:55:00 -0700 (PDT) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1.internal.synopsys.com [10.12.239.235]) by mailhost.synopsys.com (Postfix) with ESMTP id E00C13E6A; Fri, 16 Mar 2018 10:55:00 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 16 Mar 2018 10:55:00 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 16 Mar 2018 23:24:58 +0530 Received: from [10.10.161.84] (10.10.161.84) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 16 Mar 2018 23:24:57 +0530 Subject: Re: arc_usr_cmpxchg and preemption To: Alexey Brodkin , "peterz@infradead.org" CC: "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" References: <1521045375.11552.27.camel@synopsys.com> <20180314175352.GP4064@hirez.programming.kicks-ass.net> <1521221606.4805.16.camel@synopsys.com> From: Vineet Gupta Message-ID: Date: Fri, 16 Mar 2018 10:54:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1521221606.4805.16.camel@synopsys.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.10.161.84] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/16/2018 10:33 AM, Alexey Brodkin wrote: > Hi Peter, Vineet, > > On Wed, 2018-03-14 at 18:53 +0100, Peter Zijlstra wrote: >> On Wed, Mar 14, 2018 at 09:58:19AM -0700, Vineet Gupta wrote: >> >>> Well it is broken wrt the semantics the syscall is supposed to provide. >>> Preemption disabling is what prevents a concurrent thread from coming in and >>> modifying the same location (Imagine a variable which is being cmpxchg >>> concurrently by 2 threads). >>> >>> One approach is to do it the MIPS way, emulate the llsc flag - set it under >>> preemption disabled section and clear it in switch_to >> *shudder*... just catch the -EFAULT, force the write fault and retry. > More I look at this initially quite simple thing more it looks like > a can of worms... > I'd say just bite the bullet, write the patch and we can refine it there ! -Vineet