Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1161808pxb; Thu, 23 Sep 2021 20:37:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT1mxIQNrwWpm8kg9+URLNnLzaa082XV9w0sDncyOInx4I7Fj45v9OTkz6IdBQntJ6wh8w X-Received: by 2002:a05:6e02:6c9:: with SMTP id p9mr6681067ils.198.1632454668173; Thu, 23 Sep 2021 20:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632454668; cv=none; d=google.com; s=arc-20160816; b=ONedZPeeryy0H2xEJ5yrn1J5tTNsotiNjxbGFZF7vfWhApb09RsDdfjSo9SAEv6Tyh OnSrr8Ae3/uKFzhES3XszaXiQdymhhYzadGJCGMHiOG/MayyErmnNXis2YMz/OmvNSAV EHwIERjsP4kCao51o4DZdlajDHHy/l4CGm9ZATzSx+27P0sjfdaioBiJK9tJKE2M3ssH qB02WtYESuZlK1R9i654xAJpvOr5vktyXrPxMSRepVvH766RPWFfbopRjaqS9BfvJhUC ESEcOd6AhQxLdIdtZ6Ne2wEnAmIsNmyIuzLy+xbeZmWV4JVpuwyLp1DS7R7weTCBt8ZR IHSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=zb6795h3sf+9DyOQ4JlSuX+2qVQk9N09XJnWXC9Q70s=; b=oI03CB9romZ11MRDGDGDf0MpOryxUfYm2VncJoaNZDNAOtnP+B0VA4Fdnnf8Ev56ms cj5BTsj3TFdN6fEkxyJUkJwPCMYgg0FN5/RUrcq/q5jgQKrsO38kMw+DMk6xIaET5bsC 5gwBvig1w6ISgL+JP6KG4rW/Lq1hc9/LDBnNhXXndH6mxRKE14TnFTbjU3msMfv6H0u8 z7QrvjIh00pgD0mWgd6+SppKTLK9Gzay35c7z9J0RjHXEr9PP/RnrmNMiuTxqJmnV38O oe6d+zbGCGKHBJOSoWhW/UMbJVtIEv3dRDchlTuk9kyXBHC9iD+sp8N+o6kp+dg+bSbA u5Ig== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si8299021jas.73.2021.09.23.20.37.36; Thu, 23 Sep 2021 20:37:48 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244020AbhIXDi2 (ORCPT + 99 others); Thu, 23 Sep 2021 23:38:28 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:39977 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243927AbhIXDi2 (ORCPT ); Thu, 23 Sep 2021 23:38:28 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R601e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0UpOFzWH_1632454613; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0UpOFzWH_1632454613) by smtp.aliyun-inc.com(127.0.0.1); Fri, 24 Sep 2021 11:36:54 +0800 Subject: Re: [RFC PATCH] trace: prevent preemption in perf_ftrace_function_call() To: Steven Rostedt Cc: Ingo Molnar , open list References: <2470f39b-aed1-4e19-9982-206007eb0c6a@linux.alibaba.com> <20210923093359.30da8ba6@gandalf.local.home> <7f4dfb4a-d271-b3c5-f603-06cc789ba9e9@linux.alibaba.com> <20210923232619.50103473@oasis.local.home> From: =?UTF-8?B?546L6LSH?= Message-ID: Date: Fri, 24 Sep 2021 11:36:53 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210923232619.50103473@oasis.local.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/24 上午11:26, Steven Rostedt wrote: > 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. Thanks for the explain :-) Context available for scheduling should not in these situations, will move down the 'disable' in v2. Regards, Michael Wang > > -- Steve >