Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1157264pxb; Thu, 23 Sep 2021 20:27:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx99z5VnO2+KChWx7jFMi40PeJzBMqxlyTaetPXzKhuPqNT6uCm8VUvdcswzocGx1fi02BH X-Received: by 2002:a92:ca06:: with SMTP id j6mr6509708ils.243.1632454043085; Thu, 23 Sep 2021 20:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632454043; cv=none; d=google.com; s=arc-20160816; b=j7FkXaHJv/BpUviVF7mTUVjeN9KQ1gsfR/OiEpbpKZcXsM1P9RltcxfT2V8TlH+j/7 xPVfl37PIKZJADTEdyzolslyvwoI1QI/6fZq3Uwra3fzB5akXlMcMeqK68SNabCasElk AX9jR2EPTd/JKZIHGqQrIuoUz3YY7gBLUpSVXC4cTzdyRCD93pVcfxqMHnH7pRfi8w1/ b911gbV+sIMTlfc+ZoVMmDKCAor2BNTi7vYWeXu2fR9bat1nQ0hG/IKL9vvlSU7zYz1K SCjd2gvtaT+nLyXO3AvKK6GeWUcxyV8j9q1jePhv2EmswQNNNcorQnulfB4A1D62caXu fO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=7zO03xQ20c6CjLjJtnSAhZx9gT+T+8i3nnuqbMX5p7c=; b=Zr++rFHqr50iYVyaGRlmNm4RS3bGHncxPaSVyKeY3YGgafLJFvzOaFk3qn8BR2SFS5 aHQi80NQEH/Zhvwjs7tXsfGkBwRpvT0zPzeodKHZYTXnNQMrhpARoLfa5l+conBneZqX 7NQNPFIySGMqIcBrvd5380trQ/ULIg78Ad6SS9aNiftczIQltBbp4SJi2Kgs+tob7tVy zuhYAPSX4xlB6AsbXuGkSURepnxrLR3bEigGBzxmpeh124CkcyRx9lEmlNR98EGNmxNi Bqmo3pLuP+5N/GUtp6+TbImvLxt85gn5Vldg0EJNQ3Vjrijfe5t0rFtNyiglCFnHzVPm i9rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si8821943ilh.21.2021.09.23.20.27.08; Thu, 23 Sep 2021 20:27:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243958AbhIXD1y convert rfc822-to-8bit (ORCPT + 99 others); Thu, 23 Sep 2021 23:27:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:33698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235369AbhIXD1y (ORCPT ); Thu, 23 Sep 2021 23:27:54 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 315B161211; Fri, 24 Sep 2021 03:26:21 +0000 (UTC) Date: Thu, 23 Sep 2021 23:26:19 -0400 From: Steven Rostedt To: =?UTF-8?B?546L6LSH?= Cc: Ingo Molnar , open list Subject: Re: [RFC PATCH] trace: prevent preemption in perf_ftrace_function_call() Message-ID: <20210923232619.50103473@oasis.local.home> In-Reply-To: <7f4dfb4a-d271-b3c5-f603-06cc789ba9e9@linux.alibaba.com> References: <2470f39b-aed1-4e19-9982-206007eb0c6a@linux.alibaba.com> <20210923093359.30da8ba6@gandalf.local.home> <7f4dfb4a-d271-b3c5-f603-06cc789ba9e9@linux.alibaba.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Sep 2021 10:08:10 +0800 王贇 wrote: > I found the rcu tree implementation of rcu_is_watching() will check > this_cpu_ptr(&rcu_data.dynticks), and after that enable the preemption. > > If preemption happened after that and before we disable here, there are > still possibility that the CPU changed and make the dynticks checking > invalid, isn't it? If it can be scheduled, then RCU is definitely watching ;-) The rcu_is_watching() is a safe guard for places that are in between context switches. Not task context switches, but transitioning between kernel and user space, or going into or out of idle, or transitioning in and out of an interrupt. There are small critical sections that RCU is not watching, and we are actually working on making those locations disable instrumentation (like tracing), where rcu_is_watching() will no longer be needed. -- Steve