From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E44F3C433EF for ; Wed, 18 May 2022 15:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239166AbiERPKG (ORCPT ); Wed, 18 May 2022 11:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239087AbiERPKE (ORCPT ); Wed, 18 May 2022 11:10:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33D91DFD89 for ; Wed, 18 May 2022 08:10:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5642A61958 for ; Wed, 18 May 2022 15:10:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31B80C385A9; Wed, 18 May 2022 15:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652886601; bh=SIvbxlSGGzkgi9tVz1CdkOJ99ZWAfRB8ApyV15kUEX4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=u9aDk5HhIQ3k47ScSvMLrgb6tbQ8Hoqhs5CpqaQoAz0V4nc/sU//r1N0F8wF2Zna7 FkURu8/kROwW5SGQ+y0WudFSMKiCMf3iQ5WjTKiZQjrFq40wHsaObsZ/XZg7wYFwRd 8Sy39KgSwbBvZ9PHHox+qDtgfxROf3tFZdf4fBqG70mmMj2jbB0IIGiRgJLQnfcA0m r3RvGM/cKdAff0SESwBN2Lgs7BDq8pQhFlc4IsXFDcQHaXeQlQAttAJfnSe1+7qPjc UiKb6GmlQjNpH2AKiqNYNo1Uuqq82Vrq6dYpu/R5xbcCYreq6kh9hiPgxKwZDBp+Y2 hczqQ/QYUGitA== Message-ID: <372364b33b8d4b93908c3822e18f7d295de2ede9.camel@kernel.org> Subject: Re: [PATCH 20/21] context_tracking: Convert state to atomic_t From: nicolas saenz julienne To: Frederic Weisbecker , LKML Cc: Peter Zijlstra , Phil Auld , Alex Belits , Xiongfeng Wang , Neeraj Upadhyay , Thomas Gleixner , Yu Liao , Boqun Feng , "Paul E . McKenney" , Marcelo Tosatti , Paul Gortmaker , Uladzislau Rezki , Joel Fernandes Date: Wed, 18 May 2022 17:09:55 +0200 In-Reply-To: <20220503100051.2799723-21-frederic@kernel.org> References: <20220503100051.2799723-1-frederic@kernel.org> <20220503100051.2799723-21-frederic@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.1 (3.44.1-1.fc36) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2022-05-03 at 12:00 +0200, Frederic Weisbecker wrote: [...] > +/** > + * ct_state() - return the current context tracking state if known > + * > + * Returns the current cpu's context tracking state if context tracking > + * is enabled. If context tracking is disabled, returns > + * CONTEXT_DISABLED. This should be used primarily for debugging. > + */ > +static __always_inline int ct_state(void) > +{ > + int ret; > + > + if (!context_tracking_enabled()) > + return CONTEXT_DISABLED; > + > + preempt_disable(); > + ret =3D __ct_state(); > + preempt_enable(); > + > + return ret; > +} > + I can't see any use for this function with preemption enabled. You can't tr= ust the data due to CPU migration and it could be a source of bugs in the futur= e. Wouldn't it make more sense to move the burden into the callers? They all D= TRT, plus, this_cpu_ptr() will spew warnings if someone shows up and doesn't com= ply. Regards, --=20 Nicol=C3=A1s S=C3=A1enz