Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6598400yba; Tue, 14 May 2019 10:09:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzM6gCsaQ/JCXERH0gw/SFOTm/oOsxCsUxIS69/SFZRosgSxPMWFLhgdGFeoNojjZ+s8pzW X-Received: by 2002:a63:1b56:: with SMTP id b22mr38370206pgm.87.1557853784865; Tue, 14 May 2019 10:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557853784; cv=none; d=google.com; s=arc-20160816; b=eEhYQnk6AxIgxKViIhrs/BO8ZF1oXT6YYaJeoDKR1xiK5bHwQXlbmx29JOzTnUuUq5 6wZPwZKjQLmRDM2pPa0pYP4AqecfcG8U3Df/ynPIy9T25C8zbKgBXA46SEf+B0qVtC2i gfKqww9N9fgooMM/CI1OJsF2n5X35U07W0Kqlvq/e8lrmM4oXpu6N8/f0r1HEpKwtgd/ sh1gchSOT2BhwsYjVN/oUj+hCWFi052X8yGrmrLk21Z76seAGhWf9sua7d1vR8+XJuiO Fp5LwnIkpzEdJY8Q4+0DWyOp9QIbyrQu4dOt87ttrqdvTQm33WIPJiRSUCkwy5XWnR2m NSxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9ex9PPn739Xr+bGkq3/whL7LXHhKWhdJEiYFtfuJN3g=; b=xqRURju2h+2Lp+0FWkadZEQtCZDRILyxBIRms93F/+SMQmrn7VbkA4JbFnYaCqko14 8wUJXMvcEimYMYjRJPGX0D9m/IC2fMNOKh+9Ydn5zot98MBVhiD5ldnE2FK1lBK2Jyt4 +C+/USBhcc2Cp1zlrFGs+g4HIn0wWeujqM8APW5o6+plQvXcKA1Y7sP5CnzM5OHPMXN2 uVv0RiU08NTNZQbmhMCevzc3KUz0KNw9VgPqMr7xJ27aY6xpUDI8wdV0ihYFXH/INvta XQzP/O45KegXHgIRb5vTUwOWYMLLskljpLvLcPduOQBwTyHqjyw9LJURNl4PdMM+uNsJ 5xuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="O/8QoiKx"; 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 1si20741588plh.153.2019.05.14.10.09.29; Tue, 14 May 2019 10:09:44 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b="O/8QoiKx"; 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 S1726876AbfENRIN (ORCPT + 99 others); Tue, 14 May 2019 13:08:13 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44212 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbfENRIN (ORCPT ); Tue, 14 May 2019 13:08:13 -0400 Received: by mail-lj1-f194.google.com with SMTP id e13so14996420ljl.11 for ; Tue, 14 May 2019 10:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9ex9PPn739Xr+bGkq3/whL7LXHhKWhdJEiYFtfuJN3g=; b=O/8QoiKxXWtyVM4OLdq9hhH6iJGOIMQhyrS7akn0/RQ0332RmNdKap3tf+MbEVOieh U54FKLqq+K/tHAkrpmWIsKsfYE2IoIRWtDzVSWhTyFj5zSSgwXvZS10+exiHTdSMn/z7 CZmFqwK/jlzEfEx+SWY6dKNc0pdVuZenJJhmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9ex9PPn739Xr+bGkq3/whL7LXHhKWhdJEiYFtfuJN3g=; b=IupnVUnJFhGXMrToKgCT3kU8Qrks3H7hKn1UcsKhpAskr3Zfuz1qJR3ks3cRECaS4r 7+SvcN86mE5a9Acx6b+0NrpqjtyxJzBsR0509RFIyRg/c8H2tMbXm8dexcblimeVtwWj eMn5bYXqAGL9/A729CW20P5ef46ARQfhK/yM0hgfbqWOZpJOu0WQXs8miLfrObzivv3Z 2Gqf8YnApHq3sqtI8vU+6xiRaxMH95UiiRSLblCcoTnQUFB4mTnZg3cP1YcQZl5BzQkw WmPHoouu/U2I4iuEXBEMNCZMBKl6K7YQoXYVUi2VcYQwXznwjivmgBTQZrVeITfEGJak veIw== X-Gm-Message-State: APjAAAWUhgN6Emv8Ihogre+w44P0dJuDUo59GAAoCF9aHnlWSpmfteNK 8shuOoEz/TuXCXQHz7fVUcDh6HtyciY= X-Received: by 2002:a2e:6e0b:: with SMTP id j11mr17480394ljc.46.1557853690924; Tue, 14 May 2019 10:08:10 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id t7sm372102lfq.39.2019.05.14.10.08.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 10:08:10 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id w1so12464178ljw.0 for ; Tue, 14 May 2019 10:08:09 -0700 (PDT) X-Received: by 2002:a2e:a294:: with SMTP id k20mr12284722lja.118.1557853689354; Tue, 14 May 2019 10:08:09 -0700 (PDT) MIME-Version: 1.0 References: <20190424123656.484227701@infradead.org> <20190424124421.636767843@infradead.org> <20190424211759.52xraajqwudc2fza@pburton-laptop> <2b2b07cc.bf42.16a52dc4e4d.Coremail.huangpei@loongson.cn> <20190425073348.GV11158@hirez.programming.kicks-ass.net> <20190425091258.GC14281@hirez.programming.kicks-ass.net> <20190514155813.GG2677@hirez.programming.kicks-ass.net> <20190514165614.GV2623@hirez.programming.kicks-ass.net> In-Reply-To: <20190514165614.GV2623@hirez.programming.kicks-ass.net> From: Linus Torvalds Date: Tue, 14 May 2019 10:07:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Re: [RFC][PATCH 2/5] mips/atomic: Fix loongson_llsc_mb() wreckage To: Peter Zijlstra Cc: huangpei@loongson.cn, Paul Burton , "stern@rowland.harvard.edu" , "akiyks@gmail.com" , "andrea.parri@amarulasolutions.com" , "boqun.feng@gmail.com" , "dlustig@nvidia.com" , "dhowells@redhat.com" , "j.alglave@ucl.ac.uk" , "luc.maranget@inria.fr" , "npiggin@gmail.com" , "paulmck@linux.ibm.com" , "will.deacon@arm.com" , "linux-kernel@vger.kernel.org" , Huacai Chen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 14, 2019 at 9:56 AM Peter Zijlstra wrote: > > Understood; the problem is that "*p++" is not good enough for local_t > either (on load-store architectures), since it needs to be "atomic" wrt > all other instructions on that CPU, most notably exceptions. Right. But I don't think that's the issue here, since if it was then it would be a problem even on UP. And while the CPU-local ones want atomicity, they *shouldn't* have the issue of another CPU modifying them, so even if you were to lose exclusive ownership of the cacheline (because some other CPU is reading your per-cpu data for statistics of whatever), the final end result should be fine. End result: I suspect ll/sc still works for cpu-local stuff without any extra loongson hacks. But I agree that it would be good to verify. Linus