Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2040813yba; Thu, 25 Apr 2019 09:39:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvr9d1LQ3Od5WEr9zHAsdyEQmAQsOgoFGAkhqjizjLf5ZH0J/URCsR3Vj5He1F9hr8iI8Q X-Received: by 2002:a17:902:70ca:: with SMTP id l10mr2984524plt.228.1556210390291; Thu, 25 Apr 2019 09:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556210390; cv=none; d=google.com; s=arc-20160816; b=yDBfbb7eULlZg3dv2tY0B8T6mZZnTrER0TjAv7BZ9PYOTtCvpAdfAbKjrjuXyn1DK1 /Z4J9iUld283ZIit8GyS1jRkfcbzjPEqnmbCF0U5JolEcBM0r+Uc4s0xcRfdcZk48Krp MrYQfXhE2TDsxO28bEF8ue6W3RmITszYAOpK/WPuk/9GAhhU0QXP9irv6NnhMh505oLW 5T0zk2s+Z8gi1unUc1MAIY/9VDg9uw8TCkoiONYi6zKxYuwphR3Z5Ze7ySeyHDN9m426 ydAg0lXWjL6+hSaqaun5MsL/JUUQVjJISNG6FFVz9g6F+GGrTQkf9LMEDQwALW+90ZPK gFHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=O4VW8mQDLcOJ0Dh9dE0eUcZoFoMBse1+JE4GCdloxiQ=; b=v5y/lw6BDhcVtqEGwsOM8MkfGYZ2cU1p6eCblhmaZdrvTFRpa2L7WymUMCWC6YCqQd GpNuzDFIK9E8VZRpzdxJt27v7rvc3w2LBsYliHXIvQT2zgJibTEsajWMDlO9d/IRrTxt lJ87ruhzxi5Uuhc8Domx5AA4Y9wTq97FT1YfhQEj7IZ4K/9F5qkUxBf2uTl8EhmPXKl4 s0rQG6ENHsRcNjkibI0Qc6VukrdHCVgGWWD+mODdY9Z3Nk+EiXvXeU8L9WqyrIoh9Hh1 nXnPM95BdyTlKLdbwz9OJLPMjOo6ys1AsuhM8dhU9RMz4OV/OrQvunTj3S3RSoOqlWCq 8YiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DdQHhZ+r; 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 f22si11622552pgf.227.2019.04.25.09.39.35; Thu, 25 Apr 2019 09:39:50 -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=DdQHhZ+r; 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 S1727634AbfDYQSU (ORCPT + 99 others); Thu, 25 Apr 2019 12:18:20 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34044 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbfDYQSU (ORCPT ); Thu, 25 Apr 2019 12:18:20 -0400 Received: by mail-lf1-f66.google.com with SMTP id h5so240235lfm.1 for ; Thu, 25 Apr 2019 09:18:18 -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:content-transfer-encoding; bh=O4VW8mQDLcOJ0Dh9dE0eUcZoFoMBse1+JE4GCdloxiQ=; b=DdQHhZ+r9zygTgQ2vKf4L3eyggX+xGPAx6vxZOEDsSWSM2NaEoXiO6ZRQA/UG8BjFR edXmnnOlC/BU4AAsuGHsL6MbA4ian8qX7DiiW03a8dIsAYHBKJ3xo9qOyQnHrQ+1ZSs9 Ma23tQlBFpDvSJWfpfSPizVwFgzlJLHew5QaQ= 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:content-transfer-encoding; bh=O4VW8mQDLcOJ0Dh9dE0eUcZoFoMBse1+JE4GCdloxiQ=; b=rro4RfN/H2nYNyfWKBTqK1cBOsAh679qSO6Gg+2AZw1YiG+AsLuOoo4VwD5A9/GFdv p1/9+03a8KNNS+4u8o3yacxbpfG8L9y5m08fuygzNMteB7Z2jFCZn5VFUb3HJTuC2q7B c64jsmC1zYEJa8I1CtFenwcGI932lWe4elCZ2RTopE5vuH4IcgTvu7AUYSRpbWLRmj+o /rmE6rQ8OxUwO/+aNKG7F0EaVr9dKxZ6jT1TybbDIWDCivOMv3MQYuwn+b3HkWCvFEBJ yqBkSVcXRHWmwWfZS3fNoYBGymph4vLSRCSqgJi9kGVmyLH1zs1nhax16OZg2Om+ne9P Iufg== X-Gm-Message-State: APjAAAXHATws0OcjtwJn8q3KkCylBr09Oiv1lBTvGzzGCYdhH06R95T5 Ayk8FfiMVx3ZzqVWd4WlfoVV4N2/cg4= X-Received: by 2002:a19:b83:: with SMTP id 125mr6046467lfl.84.1556209097758; Thu, 25 Apr 2019 09:18:17 -0700 (PDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id m28sm5116043lfc.71.2019.04.25.09.18.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 09:18:17 -0700 (PDT) Received: by mail-lj1-f171.google.com with SMTP id p14so173944ljg.5 for ; Thu, 25 Apr 2019 09:18:17 -0700 (PDT) X-Received: by 2002:a2e:9ac8:: with SMTP id p8mr19497751ljj.79.1556208755990; Thu, 25 Apr 2019 09:12:35 -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> In-Reply-To: <2b2b07cc.bf42.16a52dc4e4d.Coremail.huangpei@loongson.cn> From: Linus Torvalds Date: Thu, 25 Apr 2019 09:12:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Re: [RFC][PATCH 2/5] mips/atomic: Fix loongson_llsc_mb() wreckage To: huangpei@loongson.cn Cc: Paul Burton , Peter Zijlstra , "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" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2019 at 9:59 PM wrote: > > In one word=EF=BC=8C the bug only affect local cpu=E2=80=98s ll/sc operat= ion, and affect MP system. > > If local_t is only ll/sc manipulated by current CPU=EF=BC=8C then no need= fix it. As to the whole MP vs UP issue: Is this "guaranteed no problem on UP" true even in the presence of DMA? I'm _hoping_ some MIPS chips are starting to be coherent with DMA (but maybe DMA never participates in any coherency traffic that could trigger the bug even if the DMA _were_ to be coherent?). Also, as Peter mentioned, we do depend on ll/sc also reacting to interrupts - again including on UP systems, of course. I assume that's always handled correctly, and that an interrupt will set the right state that the SC will not succeed? Finally, it worries me a bit that the loongson_llsc_mb() things are all at the C level, so who knows what compiler behavior you'll see between the ll/sc inline asm, and the loongson_llsc_mb() generation. Hopefully not a lot (and presumably mostly just stack reloads etc that probably don't change any cache state), but I do wonder if the loongson quirk should be *inside* the asm rather than separate. Linus