Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp298127ybi; Thu, 1 Aug 2019 19:20:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4kkNyt7HuRUf512z8Z2Y+okfTWfIn93YzgB4iwA/QGMeH03PhYBmqoja/xu7mc1sYyMrG X-Received: by 2002:a65:57ca:: with SMTP id q10mr125550968pgr.52.1564712450997; Thu, 01 Aug 2019 19:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564712450; cv=none; d=google.com; s=arc-20160816; b=Uh6q4Dpeoi1C1n2pi9Sklj14yZZR9ID3sh7VGXls87YiwUcEfoju4z4sXbn2AZjB9G S8KSha1AT7oeWOvjT0Ew8vfjMq4ZWJvYWmgGpjIDoYOo9A/84mrv1zxDvbLLOODP+n5D pHVJjK2gBvcTAR57FaT3lewUWzCy0bm1gu2DFtA/rmKpK7a3On2eb54EegdLyNQg9qxT yBKPQV5srOmBJLuy7szuoLfU0rJDSPzszTG2MVVYLMIJ4redeuQiWRbE3X4CjSuK0ZN9 oeUvWUey6sacnzwjxHIPUwEw1y4JVBZ5dyTt1GQMwhkz78YR/SPAZAzGs4otmf5+eGvE LlUw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kT6d62v3IkstWdOxiS46a/cLyvcRbEdBparblNqkUuo=; b=naZZ1coA7sOY5nACFqMB7aNw9xxR/AtpvHzaCYJ7TAjocI+xgWKsI8E763VsNbw8CY xuAUKrajfpCQiuYNCd9abMGRWFKR19Oi3tfVdrUFwjYvX3Wve3DrkLQxLGXF+DL8l3Sf LcVxPEBqARoqnEdFLQgsvEsAAildUWjGD4JJ3L6XX3GRNzQMIwkUn5wtsIomCEfDTJra R0iv017R8dVo6gSR5t4G1Guft5aYaRcdMhbHttB63wTeSfpAqLevT8JCV7ym8wUFy4XZ bdPkKtgBIvMDF6GIxBm7ftp3Tizp48cWDSdKffnasgWPooBtB1hu/PosrAxC03zfOtoX XFcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=NQQjvORh; 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 s5si34943610plq.219.2019.08.01.19.20.33; Thu, 01 Aug 2019 19:20: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=@joelfernandes.org header.s=google header.b=NQQjvORh; 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 S2389224AbfHAVjj (ORCPT + 99 others); Thu, 1 Aug 2019 17:39:39 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37790 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389175AbfHAVjg (ORCPT ); Thu, 1 Aug 2019 17:39:36 -0400 Received: by mail-pg1-f195.google.com with SMTP id d1so2095004pgp.4 for ; Thu, 01 Aug 2019 14:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kT6d62v3IkstWdOxiS46a/cLyvcRbEdBparblNqkUuo=; b=NQQjvORho9kJQQ2IzD8WqRk3/pXGXfIdnxH+fkC6qgXk0sSN2OtDUpI6sa7OKd/0nW XeKn9c4Zjgw+uT9+Y12kI0VVIkflkSeL06HubY6fxQluDH3CQ9AiaIqI/fFnCZU40iIR Rq3cFbzm2ldhmVJWIlFT86ZdK82S/+ceQXsNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kT6d62v3IkstWdOxiS46a/cLyvcRbEdBparblNqkUuo=; b=pHhaGvfpF/bwcCaT0ekwcMGHlPJdCkJrdbPulDjrrIAL/op2JftQL5YFKCg7k1OkRP Bm6AMbTYQP25Yeo4blqfT3K/RZbNk5RvOYjBj++Dyor5uX/n3IFlldcyHkuRNB2LBiJj bbi6klVS6viHxJ0Ta3klWG1zhdjx3x8wlDLMjP/E9rXyH8fsZKRNpY1pDIGa21+BKuk/ pZhWAL+DvDKoyP0g1sBxXGJ2XOTZVZLhYBM83l1ewqqxDbivMk6+ZqdS7AkG8IqABBgw L3YvwiowrRecHQsdnEBSera9hauWSaJI/Vnskr1vsfpjLv8lWIHOnQ2ODoSHWcgvAMY5 kTxg== X-Gm-Message-State: APjAAAXEQVWy6amic0ROP6W5l7SMI6XQYQpIesDiw24wSj9mnLNSMUT6 f2nUSDNiRORg4yYTaubAUAFDG3eD X-Received: by 2002:a62:e20b:: with SMTP id a11mr56432547pfi.0.1564695575463; Thu, 01 Aug 2019 14:39:35 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id r61sm5940423pjb.7.2019.08.01.14.39.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 14:39:34 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Mauro Carvalho Chehab , "Paul E. McKenney" , rcu@vger.kernel.org Subject: ['PATCH v2' 1/7] Revert docs from "rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()" Date: Thu, 1 Aug 2019 17:39:16 -0400 Message-Id: <20190801213922.158860-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190801213922.158860-1-joel@joelfernandes.org> References: <20190801213922.158860-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts docs from commit d6b9cd7dc8e041ee83cb1362fce59a3cdb1f2709. --- .../RCU/Design/Requirements/Requirements.html | 71 ------------------- 1 file changed, 71 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.html b/Documentation/RCU/Design/Requirements/Requirements.html index 467251f7fef6..bdbc84f1b949 100644 --- a/Documentation/RCU/Design/Requirements/Requirements.html +++ b/Documentation/RCU/Design/Requirements/Requirements.html @@ -2129,8 +2129,6 @@ Some of the relevant points of interest are as follows:
  • Hotplug CPU.
  • Scheduler and RCU.
  • Tracing and RCU. -
  • -Accesses to User Memory and RCU.
  • Energy Efficiency.
  • Scheduling-Clock Interrupts and RCU. @@ -2523,75 +2521,6 @@ cannot be used. The tracing folks both located the requirement and provided the needed fix, so this surprise requirement was relatively painless. -

    -Accesses to User Memory and RCU

    - -

    -The kernel needs to access user-space memory, for example, to access -data referenced by system-call parameters. -The get_user() macro does this job. - -

    -However, user-space memory might well be paged out, which means -that get_user() might well page-fault and thus block while -waiting for the resulting I/O to complete. -It would be a very bad thing for the compiler to reorder -a get_user() invocation into an RCU read-side critical -section. -For example, suppose that the source code looked like this: - -

    -
    - 1 rcu_read_lock();
    - 2 p = rcu_dereference(gp);
    - 3 v = p->value;
    - 4 rcu_read_unlock();
    - 5 get_user(user_v, user_p);
    - 6 do_something_with(v, user_v);
    -
    -
    - -

    -The compiler must not be permitted to transform this source code into -the following: - -

    -
    - 1 rcu_read_lock();
    - 2 p = rcu_dereference(gp);
    - 3 get_user(user_v, user_p); // BUG: POSSIBLE PAGE FAULT!!!
    - 4 v = p->value;
    - 5 rcu_read_unlock();
    - 6 do_something_with(v, user_v);
    -
    -
    - -

    -If the compiler did make this transformation in a -CONFIG_PREEMPT=n kernel build, and if get_user() did -page fault, the result would be a quiescent state in the middle -of an RCU read-side critical section. -This misplaced quiescent state could result in line 4 being -a use-after-free access, which could be bad for your kernel's -actuarial statistics. -Similar examples can be constructed with the call to get_user() -preceding the rcu_read_lock(). - -

    -Unfortunately, get_user() doesn't have any particular -ordering properties, and in some architectures the underlying asm -isn't even marked volatile. -And even if it was marked volatile, the above access to -p->value is not volatile, so the compiler would not have any -reason to keep those two accesses in order. - -

    -Therefore, the Linux-kernel definitions of rcu_read_lock() -and rcu_read_unlock() must act as compiler barriers, -at least for outermost instances of rcu_read_lock() and -rcu_read_unlock() within a nested set of RCU read-side critical -sections. -

    Energy Efficiency

    -- 2.22.0.770.g0f2c4a37fd-goog