Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3480107ybl; Sun, 12 Jan 2020 19:17:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwz2nkuQtyUl3ZioOFVDZAy782Qhj7ajAC1e74gnbT33HHB5Dm2lgInp4FMDg8liGmpSDu0 X-Received: by 2002:aca:2419:: with SMTP id n25mr11371164oic.13.1578885475122; Sun, 12 Jan 2020 19:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578885475; cv=none; d=google.com; s=arc-20160816; b=wQodKY3OegiAPFcqcMFzZ4x1JlFM0F2DPDugD3O40ORSlx8UITWou+psccvnaL4irA hCUYdIULLhOdMvgmPlIwTo7FcXilQzhIyzr1KlET/NqqTiK10/1lv5WnakfzB+n6eMnj QjTPxIy1GDjuE1q5v/bZyz/1S1JjdQ253R/Y5GxGRX7DL+HY7hLwobu11f/69DQVhzDi Tq/xJ85A2Jyky4p1XnvBwqxqjHR6Gn7/6jVxdPihUMKm+jl5xk1vX4y8+N1PDDF7/a9i Djf7rGW3UCQol8YKVoj7Lp/xnkBW1NKnXuIUcbPCdYTEHu/3yIiWampHLt2CFYAk4HM7 kF4g== 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:subject:cc:to:from:date :dkim-signature; bh=RtF8Fy/3e3MKYy20ILc4W1We4iaZZ8c0W/GVUoDwiGc=; b=Og/aR4c0/+lA5oCv8L9u89xUqhyb11f+3H2UVS4CicbEJi00yDWtR2AaF9gnMJyOi3 S3EmAmMO3nYVjLp9Uf50O0hpmxZ8Fhr51Qih48YJqfYZc+U0rLhd1D68qr6jKaGzjlsI SoJOLKKi13xUZzL5qhKGAsDNI5Pcxuw5V4dZ5bz3v4GnoboVv/8JraVk4/jTr2TOWhMu kcb1W0TqKpM3Goo/d4aslmPTlpG+Vm/5nD8s6gYNZ8d5HCzFWpirqY0S+eQRDzq/msUx pXU+DB6ItdBc7+xHpBZMBHyRwN0tVKDdBdAsd0fzhqO78tzAJDcrJ2edDaAU4unM+kn7 DKWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RCdMxJUO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si5838970oti.303.2020.01.12.19.17.42; Sun, 12 Jan 2020 19:17:55 -0800 (PST) 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=@kernel.org header.s=default header.b=RCdMxJUO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733112AbgAMDQp (ORCPT + 99 others); Sun, 12 Jan 2020 22:16:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:54826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732961AbgAMDQp (ORCPT ); Sun, 12 Jan 2020 22:16:45 -0500 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B025721556; Mon, 13 Jan 2020 03:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578885404; bh=3zYO/LV7CNbRZmQEB1qLQGLItuEsGDzoXBLkzEVNe2c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RCdMxJUOUJEUP6ZUIV4gkd0trBnyqFBTGpbWavtcwtLwkOB8MXaEFeJ3rAwHW6SAh BVmV/1FnfE9vhJDJtPEo1A9BwKoH+PYD0Ob2nYi3IxYH3Er8nN1pKfhOde6flu8GYe dY1HHkqDJzlAqqI0qXTA6vhjyBUAPpyuDy0P0A/Q= Date: Mon, 13 Jan 2020 12:16:40 +0900 From: Masami Hiramatsu To: Joel Fernandes Cc: Ingo Molnar , Anders Roxell , paulmck@kernel.org, "Naveen N . Rao" , Anil S Keshavamurthy , David Miller , Linux Kernel Mailing List Subject: Re: [PATCH -tip V2 0/2] kprobes: Fix RCU warning and cleanup Message-Id: <20200113121640.bfab48c105dae9b1918c2d82@kernel.org> In-Reply-To: <20200112020537.GJ128013@google.com> References: <157535316659.16485.11817291759382261088.stgit@devnote2> <20191221035541.69fc05613351b8dabd6e1a44@kernel.org> <20200107211535.233e7ff396f867ee1348178b@kernel.org> <20200110211438.GE128013@google.com> <20200111083507.c32b85b1d47aa69928de530b@kernel.org> <20200112020537.GJ128013@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 11 Jan 2020 21:05:37 -0500 Joel Fernandes wrote: > On Sat, Jan 11, 2020 at 08:35:07AM +0900, Masami Hiramatsu wrote: > > Hi Joel and Paul, > > > > On Fri, 10 Jan 2020 16:14:38 -0500 > > Joel Fernandes wrote: > > > > > On Tue, Jan 07, 2020 at 09:15:35PM +0900, Masami Hiramatsu wrote: > > > > Hello, > > > > > > > > Anyone have any comment on this series? > > > > Without this series, I still see the suspicious RCU warning for kprobe on -tip tree. > > > > > > +Paul since RCU. > > > > > > Hi Masami, > > > > > > I believe I had commented before that I don't agree with this patch: > > > https://lore.kernel.org/lkml/157535318870.16485.6366477974356032624.stgit@devnote2/ > > > > > > The rationale you used is to replace RCU-api with non-RCU api just to avoid > > > warnings. I think a better approach is to use RCU api and pass the optional > > > expression to silence the false-positive warnings by informing the RCU API > > > about the fact that locks are held (similar to what we do for > > > rcu_dereference_protected()). The RCU API will do additional checking > > > (such as making sure preemption is disabled for safe RCU usage etc) as well. > > > > Yes, that is what I did in [1/2] for get_kprobe(). > > Let me clarify the RCU list usage in [2/2]. > > > > With the careful check, other list traversals never be done in non-sleepable > > context, those are always runs with kprobe_mutex held. > > If I correctly understand the Documentation/RCU/listRCU.rst, we should/can use > > non-RCU api for those cases, or do I miss something? > > Yes, that is fine. However personally I prefer not to mix usage of > list_for_each_entry_rcu() and list_for_each_entry() on the same pointer > (kprobe_table). I think it is more confusing and error prone. Just use > list_for_each_entry_rcu() everywhere and pass the appropriate lockdep > expression, instead of calling lockdep_assert_held() independently. Is this > not doable? Hmm, but isn't it more confusing that user just take a mutex but no rcu_read_lock() with list_for_each_entry_rcu()? In that case, sometimes it might sleep inside list_for_each_entry_rcu(), I thought that might be more confusing mind model for users... Anyway, if so, please update Documentation/RCU/listRCU.rst too. Thank you, -- Masami Hiramatsu