Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1717798lqg; Mon, 4 Mar 2024 01:16:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUuNmLtCjMEnoNeEfFB4YAjUvhZ+4Ox7m4XqEaCaYWfdkinKASzJG07dHv0//3f2WxzMaIpjYOwOJBdtyDUCpkvw+PX/J44T2+t3QV1+A== X-Google-Smtp-Source: AGHT+IF4Nno5UDFJ6QSFUFW3ABgro/c9bauBao/Fu2HskLHfrvkZoOX2DGA9bA1yxQdBZ0If+BGd X-Received: by 2002:a05:6a00:22cc:b0:6e5:9031:9886 with SMTP id f12-20020a056a0022cc00b006e590319886mr8485991pfj.25.1709543781078; Mon, 04 Mar 2024 01:16:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709543781; cv=pass; d=google.com; s=arc-20160816; b=Yuf4sUA43CoKRUHxwZjOqeUdfx7IEKgQL1TZuMc6GZMOCCsP0NYN4hSz5QF0PRohzm HYsUcnhoB1DLwDPFEf5viVBkt8Y6xxyv61HgBAUbQya2Lg83wFoyhbQe1SkleaNBZFpF 7Z7eEIep77+bLrNwjtPKoSJQD9FyKqspBa6hI8NeqbzRElE7qxjGyaX7kdMq8jtWOTzL SLhuePw3gMAfCM5MyxvqTfnioBFSFBO43d8jNQLAOu6ig/m1cZzOxWq8uMnf12jnD7Y6 kqPHdiacUlFjeVVO6TrMEDzmHlzFnRp2OzqpBglfMpWAQM76TmTxLWuhvMBJaqSy5pgA dNzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=AWM0i1D+FispfxeIOLK4vZoGix8afRI2zst62UErbPs=; fh=fFg+jcaLNFQHMiQNPx/TNvjxytKtifYMTG9WM7T+rUE=; b=ux+LhUY085nUybYmsmnZQNIUzOwfu+IEBo3Nq5lDJqza9ALvqg52uZkijJZOSBdSz/ dvt0XQNuH+LkXjr9DqKnauaSRCTKkTtj8tbQJTNQ/BeAr0t44Vw64BNhMFhT1rjNnXNB 9vSJsyBkUkywz6/UWNLC30HGiUAqGVKcbm/6NhiL8yhCpMIIHu0i11k/GpOWK9udrezM UASmlw+b+5Ey5iXR1YzeYmhgkTrT0Yny3xWd5c48iXgyX0ZscX0M4CvNyNaamS+tXv52 T+SURHB7AZvU+YpdhwpPLDVyVH9O1wgz8xG33ZYyNWsjujzm1mAp6qtymUS/lVcl93ni A8pg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=rDYzV2TL; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-90285-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90285-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f20-20020a056a00229400b006e5c1ca175dsi5764451pfe.389.2024.03.04.01.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:16:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90285-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=rDYzV2TL; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-90285-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90285-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9301D2833B1 for ; Mon, 4 Mar 2024 09:16:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA0581BDEE; Mon, 4 Mar 2024 09:16:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="rDYzV2TL" Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41B211B7F1 for ; Mon, 4 Mar 2024 09:16:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543769; cv=none; b=byhn+nBUR25ywXK4eMf0AQgv//5tE+pZ2FhDMH+COHKCHbtdV8yDOJ36SRnuFa/cJgOP9g/zTqu4PKz2RhplBnKkyDuxsyASv749iSKKDhGLfr9twVrHRIafcMXsRRrFJnk6xd01S+zqqZk9FIyXy6V5MGdUtT8DluHkwU/71ho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543769; c=relaxed/simple; bh=7/Cg7bSkP3P3KzE9IpfjIHLKep/5j0YfikDfAl96988=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=BsYrQiwmoIUmAjqKJ+M9DH8jIxIH5//C/D78tE4lxLur4BAKXT/SMwmnSQPqjRl3ACOqYY2YiGY+MTa5hQ1zHfkZvL2tJ5dLBW0o2/ue/4Gd73xIinq99yZ4wJp0Y/aEC25ZAbJ4YioIyKH3xqH1QPDqts3mQHItjmNFUkgrdTQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org; spf=pass smtp.mailfrom=joelfernandes.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b=rDYzV2TL; arc=none smtp.client-ip=209.85.219.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-68f51ba7043so29128576d6.3 for ; Mon, 04 Mar 2024 01:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1709543767; x=1710148567; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=AWM0i1D+FispfxeIOLK4vZoGix8afRI2zst62UErbPs=; b=rDYzV2TLx1y2l/44xBbi2rloN3uAyytTyJ3BLccvZ9p3519cGkwmK8pNAj6PqLt9Ag RGWFoJ+D/ZO1YpObXtqsYScF84CVIoeUbaiFIXTULcN0G22XBrzCEvQ34spkHg2LkIRl Kv/d+ALiRJqrAVbgw+DsyoEbFMTvjop8IjIAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709543767; x=1710148567; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AWM0i1D+FispfxeIOLK4vZoGix8afRI2zst62UErbPs=; b=hiaCuYNYRp7QCPvIGnvASbweidNVzsym581mMGeH+wHG5NH7JArMOmUjx6Yh8kFgwD azfwDbyxyw53mESRbw5yK2F7ByiUKl7F4kPtaCLIhK/9jrMu2OOfdDyPcYSFfg7NvTok Km3cqw2ZN/RfE/7kMyITYTUaO3lVBIeOkWZbCmNB+UzkVTgnK42rM+5mami3DHwz7qcd Z8YqY48E4fUfiD5BAsDXImH/lUpfE4Qv2O0+gHw7p2J9nrD9xD6L/Kk+DMxz97VXyMQc j1Msc2WRKhHGLaM0iQadNVUvZ0ZsfgIw7M7mGsgv8hK/bFdk5cIRRTcirm/5oKtlNS36 gT3Q== X-Forwarded-Encrypted: i=1; AJvYcCVITxjGf5v+gLYmueT4zQhyC88SXxbVAcezAPeVcOV1E3ZVz61mdW9txyVQK1Gn3fcLc5/gb5ag368xwqYYyZP/v+MnxOKbC4mg3jJs X-Gm-Message-State: AOJu0YxEQAVrcAWPjT4RiyGdKgXh1opW0GovZwBSqylAhfS6EyYbMX8o Vb2/seninTqfJl8SYN2c5PTYNb0ylffQRsmVcqzIQFmR2/ecKJhf6cbWXZgHFBY= X-Received: by 2002:a0c:e303:0:b0:68f:19a7:cd4e with SMTP id s3-20020a0ce303000000b0068f19a7cd4emr9377247qvl.33.1709543767119; Mon, 04 Mar 2024 01:16:07 -0800 (PST) Received: from [10.5.0.2] ([91.196.69.189]) by smtp.gmail.com with ESMTPSA id lz4-20020a0562145c4400b0068f4520e42dsm4913063qvb.16.2024.03.04.01.16.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 01:16:06 -0800 (PST) Message-ID: Date: Mon, 4 Mar 2024 04:16:01 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] net: raise RCU qs after each threaded NAPI poll Content-Language: en-US From: Joel Fernandes To: paulmck@kernel.org Cc: Steven Rostedt , Network Development , LKML , rcu@vger.kernel.org, kernel-team References: <55900c6a-f181-4c5c-8de2-bca640c4af3e@paulmck-laptop> <10FC3F5F-AA33-4F81-9EB6-87EB2D41F3EE@joelfernandes.org> <99b2ccae-07f6-4350-9c55-25ec7ae065c0@paulmck-laptop> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Paul, On 3/2/2024 8:01 PM, Joel Fernandes wrote: >> As you noted, one thing that Ankur's series changes is that preemption >> can occur anywhere that it is not specifically disabled in kernels >> built with CONFIG_PREEMPT_NONE=y or CONFIG_PREEMPT_VOLUNTARY=y. This in >> turn changes Tasks Rude RCU's definition of a quiescent state for these >> kernels, adding all code regions where preemption is not specifically >> disabled to the list of such quiescent states. >> >> Although from what I know, this is OK, it would be good to check the >> calls to call_rcu_tasks_rude() or synchronize_rcu_tasks_rude() are set >> up so as to expect these new quiescent states. One example where it >> would definitely be OK is if there was a call to synchronize_rcu_tasks() >> right before or after that call to synchronize_rcu_tasks_rude(). >> >> Would you be willing to check the call sites to verify that they >> are OK with this change in > Yes, I will analyze and make sure those users did not unexpectedly > assume something about AUTO (i.e. preempt enabled sections using > readers). Other than RCU test code, there are just 3 call sites for RUDE right now, all in ftrace.c. (Long story short, PREEMPT_AUTO should not cause wreckage in TASKS_RCU_RUDE other than any preexisting wreckage that !PREEMPT_AUTO already had. Steve is on CC as well to CMIIW). Case 1: For !CONFIG_DYNAMIC_FTRACE update of ftrace_trace_function This config is itself expected to be slow. However seeing what it does, it is trying to make sure the global function pointer "ftrace_trace_function" is updated and any readers of that pointers would have finished reading it. I don't personally think preemption has to be disabled across the entirety of the section that calls into this function. So sensitivity to preempt disabling should not be relevant for this case IMO, but lets see if ftrace folks disagree (on CC). It has more to do with, any callers of this function pointer are no longer calling into the old function. Case 2: Trampoline structures accessing For this there is a code comment that says preemption will disabled so it should not be dependent on any of the preemptiblity modes, because preempt_disable() should disable preempt with PREEMPT_AUTO. /* * We need to do a hard force of sched synchronization. * This is because we use preempt_disable() to do RCU, but * the function tracers can be called where RCU is not watching * (like before user_exit()). We can not rely on the RCU * infrastructure to do the synchronization, thus we must do it * ourselves. */ synchronize_rcu_tasks_rude(); [...] ftrace_trampoline_free(ops); Code comment probably needs update because it says 'can not rely on RCU..' ;-) My *guess* is the preempt_disable() mentioned in this case is ftrace_ops_trampoline() where trampoline-related datas tructures are accessed for stack unwinding purposes. This is a data structure protection thing AFAICS and nothing to do with "trampoline execution" itself which needs "Tasks RCU" to allow for preemption in trampolines. Case 3: This has to do with update of function graph tracing and there is the same comment as case 2, where preempt will be disabled in readers, so it should be safe for PREEMPT_AUTO (famous last words). Though I am not yet able to locate that preempt_disable() which is not an PREEMPT_AUTO-related issue anyway. Maybe its buried in function graph tracing logic somewhere? Finally, my thought also was, if any of these thread usages/cases of Tasks RCU RUDE assume working only on a CONFIG_PREEMPT_NONE=y or CONFIG_PREEMPT_VOLUNTARY=y kernel, that could be worrying but AFAICS, they don't assume anything related to that. thanks, - Joel