Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1717911lqg; Mon, 4 Mar 2024 01:16:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVZ9uWO90dzTAh2PN0iufM2RhR57q/K0d+fsEdt/NXJJNW1PVQdtsv7ObAle1vgU567E9yUgvybXudv41wHtDddZbQjVyOGE/YF4R9Pcg== X-Google-Smtp-Source: AGHT+IExROnDcuI939IRA9X5WXeETXD33bbgSOUOEcvJFcAJMZhlSjzMFS0CAeGCaYOWbnjIPYio X-Received: by 2002:a17:90a:df13:b0:299:3e54:83fe with SMTP id gp19-20020a17090adf1300b002993e5483femr5644156pjb.36.1709543800365; Mon, 04 Mar 2024 01:16:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709543800; cv=pass; d=google.com; s=arc-20160816; b=BHGbVWzzyDcK/FauSe0x6dDeS0UDi7SfkCBDDgzwUH3tP+yKoHCUxiJS+Gbml0aPpt Fmi+IBSUBNtQrZfkHz8WM5liNWhh+WjqwPn32dq/wcn2PF+hYdXXv9LkGunYJOm3L4kL FT72hZ42gBexCMYPQX9AMDvTpYrZIgWUA7T7p57/WwGN/3CZs2dkJWJdSy2gvGGtdHcv hheEfYhqhf1W2hT70Ls6gFcx8T6z6UxdbGyGSIa/IbdEc+5UrTFddouE857VPC9ZkNSO 0exkvkYHEaMhc1fiQYhQVS3vzVML2MX2tenWzto/7T7aTOucOEGf45RIaqAHXW5ICugv m72g== 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=2+x/4kUx5YkPhI9YoStDWwAAsL1+PrsjZH0DEbj6Om0=; b=Ya+7UCcmF4FPMi7LwOSggxrEFTCNrlEuqfpjrai4NGQXoET9OHav93UnNESmxgu1jF LUejN6It8GdzLrQU3tsI+dp0r6rQukZ30sij4NZstI9SU/6DaW+I7FzlAdd6osTF++kr VLJZqQDqGlIvs44WWQpHnsLnYpPd4tZwJqblnM7RVvscaI/iJ6RdkO6uh8ZnybN+7fNP 5z03mtTGq2RiB1C5BBMUNw2N8q4QVuib8zPeKOVyMcCQXvqm7CikygQbqg4HslbnVyHz KnMRMLYxL14BW/8sHSusIxocNW1rXJ7lH35MVFOyP0OviRqCzfiuzPeal7JqGO4jcCFR +4MQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=S7cXE67V; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-90286-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90286-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 mw10-20020a17090b4d0a00b0029a1861c273si8293150pjb.73.2024.03.04.01.16.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:16:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90286-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=S7cXE67V; arc=pass (i=1 spf=pass spfdomain=joelfernandes.org dkim=pass dkdomain=joelfernandes.org); spf=pass (google.com: domain of linux-kernel+bounces-90286-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90286-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 0A5FF28336A for ; Mon, 4 Mar 2024 09:16:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80A40219E0; Mon, 4 Mar 2024 09:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="S7cXE67V" 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 0532B1B95C for ; Mon, 4 Mar 2024 09:16:18 +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=1709543780; cv=none; b=RKu7fbpq/7J+ygfPogDR8CQgyxFhiEMeUDAVDmE4O3yeLKkBRfisaIGoJXpZTIAcwyYOif8WoubdTkutvkzYsDrliDnM0oaLiqwk/mOyxdVvpRW5zCgEy03Y7TH6YoL+/wh7VfidHeErDok5PUFglRiS9dxiLWUIxNydUGMz9m0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543780; c=relaxed/simple; bh=7/Cg7bSkP3P3KzE9IpfjIHLKep/5j0YfikDfAl96988=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=q6n8/OxX6p1eY2sxjsg60XFMOBAulFMiYjnr9k/bMLxTQKPFfC7yO8cVRsThMi/xJN+vTLhaSMxbtI9ut4AeHC8ba2u5k5ch5scNSfTN49q19+QnQ4OroGltWtpmhMad4UfBQcHp6G8rl6A395BovTn/FTJpcy9uOPK4IcUisMw= 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=S7cXE67V; 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-68fb7928970so19836776d6.2 for ; Mon, 04 Mar 2024 01:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1709543778; x=1710148578; 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=S7cXE67VDKzOS8oEhk2wOe1+UYaku8agA6xf2gN9Dgis7hG8ysJyI/YR1VOG1ckm0E /KgB3L9GeFOmeV/rzKIkN48qvIQNwU7QNz3vDm6xG0Lu1bttYm0m/rLorUbwD9pxXs8l ewSL50KVriy9aY4RCmrSDB7OXDfDBmLnhFevU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709543778; x=1710148578; 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=XFNsm09AZDSyyKN2knXCEp2v+T3hkRpjNPQ9YXVk1cZpB9AkqfBKmiiUuwgAn80xou YBWRbYoxEcm0EYiTdNx8Wx4mblmgkhTt6N8w1AQzAXsfbngPjVNte/tb4xg6lmJI6Osc JIzwfbtExEAwBuwy9GUQb+Dls4wSZitgKxf1QWjQMIXRCrsWZbc33F7hROUJ4Sff/14V xNLCjdSghioZ+mhotH87tQeHgFHm7qo0P21S/ngPUrBJw3NV0/ii31sRUHNBCKTOzO3C f02CTbsLHKpV29/OGGpelYguCvE4gI/ftUYIqDdkTO/j7OHhwN2xOUTWb7qiIORjmq+M AP/g== X-Forwarded-Encrypted: i=1; AJvYcCVoKg2JVY/kHHLL9Cums7T8Iir+oVb5iWFfNC1NT6BRw1LmS1XPA0wOsTRQsVK7m/kNHE4ePau4UZCQ7I26oJiaaTo5LPuR2G4xt6SI X-Gm-Message-State: AOJu0Ywn7u1Jxd8Zc1uCYl3kwBLY0D5SPBVe6yO71DniiTVhuJOISWX6 6cq2p/bFFAE4VnpxFDrY280o8gxfeGG2fICa8MCHtrZpo+DC08hWloWAnZNYzLU= X-Received: by 2002:a0c:c20a:0:b0:68f:43f6:4834 with SMTP id l10-20020a0cc20a000000b0068f43f64834mr8682070qvh.26.1709543777882; Mon, 04 Mar 2024 01:16:17 -0800 (PST) Received: from [10.5.0.2] ([91.196.69.189]) by smtp.gmail.com with ESMTPSA id b18-20020a0ccd12000000b0068f760929c0sm4898018qvm.71.2024.03.04.01.16.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 01:16:17 -0800 (PST) Message-ID: Date: Mon, 4 Mar 2024 04:16:12 -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