Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1995859pxa; Sun, 16 Aug 2020 19:21:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc7ePwlMP84Ea20Ic74u0l8p7KpsyG7Je1rh/iwebRsz6mnyaz5HXU6rBTun9fpk13F83t X-Received: by 2002:a17:906:6d54:: with SMTP id a20mr13693782ejt.501.1597630872498; Sun, 16 Aug 2020 19:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597630872; cv=none; d=google.com; s=arc-20160816; b=M4aasUCwe2Wr56Fc7Iss5BlOel0q/ypl9EK09deZK6zUUKOsaiUdroZhnMVdoIXIk5 iE6TZrM/GsoUePKw5YWBVmd1V0U55fTZ9L1l1DxyhH9tnxfS72/VdKY92zU59sTX7btF QTTCR06sv63i13Pz5I4DCeyE9LopTOi4fIMH+wzLY3Pv4bwREUF3dy+LakYVnNCYyahZ xOa4QGTU1pX8vw3G+D4qK/NDLlTpk5d6OgoulZvLtpkUNoOo80rqEInT2XEl+elNKeGK mcN1ojj4nqfc0+iKUlyEMq7uv2h4zuJQVpkug1rUKSARYvpG/82sNI2Ebf7ee85Rod3W lDrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=uqAO2eKY9Y7otrQtCI3kjfvUUTn3TVZjRuRfzj1BvZ0=; b=ioaeGmjKjUMRmM1ij1SrwaEcfhuWPkCyR9fVvFuZ1C1mWtKxkTtdH1mli20L7D+4TW IbQRNx6KvslHdNfSaHrel7NZuT8F4jBHldUCuBvEhnKsurzNUzx42pawUhfWUX8wwVpd gZxxGmAkN+N/25DPAcEeeBvtQBag8/hvljhfg73MzCM8A1Dr+J0SuoefB7jRCWtPcTKo BrQDDQuc/CIbSB8G+SVYsG1LOzTj/DUsf5Ne/wA8jUG4i5u5h701tNj6V5oFLlILxNrU AuLk9rWgdXC5DALG6dlx3WNb0L6ES0ukzkXIfLs2yAgXWdgHcmUQuKNRD6APJ1MJ8/y7 n8Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="lyKSy2/l"; 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 k17si10151350ejv.169.2020.08.16.19.20.49; Sun, 16 Aug 2020 19:21:12 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b="lyKSy2/l"; 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 S1726802AbgHQCRR (ORCPT + 99 others); Sun, 16 Aug 2020 22:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbgHQCRQ (ORCPT ); Sun, 16 Aug 2020 22:17:16 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C41C061786 for ; Sun, 16 Aug 2020 19:17:16 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id n129so13736509qkd.6 for ; Sun, 16 Aug 2020 19:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uqAO2eKY9Y7otrQtCI3kjfvUUTn3TVZjRuRfzj1BvZ0=; b=lyKSy2/lHFlddjusFhNKx9OryoOuhL2Je2b1tqGSkEOfuD1pThTA6sYPYf1mWHM8pI M7jpkrsC+IhiKm3rSTDN7CQJzv1+ttkD/Uzg/0lPI88SgnzZSvxq+ViEecvvLstA+SGx fixz7gsLq7QDYji9+j9++oNS5sSztqQa8y/N8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uqAO2eKY9Y7otrQtCI3kjfvUUTn3TVZjRuRfzj1BvZ0=; b=kiXlZz38Cg7yHaHsMUf/U1nyMwPSCeU7V6IJSKXdiB1XojDcgzdq8O3czhjWXElrjM KvgPx5tOl8+GNQ+WV96iNC8RRUUiLpno159AxoerUzT2sihA4Zsu6gIin+TUQfLMI0Bg OlMvU+FvL33vUtOvXDdWyuRsFOfYqeZ1RGUcavVcntvXw6Aheu+5QYGA7E/fZ9RaHpwU i2bn452YZIxXfA1rVuqgXq1p13A9nOCptOp455TGVORNlGjq7wizPizOkTn0pSw0syaV ZK+9CxaQkspzMmnrLkfusEkq6Gptg5osJyEtW9XzYh1UxK8qBWNCh01LDVc9wAEqvCo7 mOHw== X-Gm-Message-State: AOAM533AMShBDynPyziPZo3zoIfrxCXQhw877DR7vlVJx8Y3eyWE3GlR yNWMH3e8UkKA/0H6Q+Fp1waQSw== X-Received: by 2002:a37:bd8:: with SMTP id 207mr11135792qkl.211.1597630635530; Sun, 16 Aug 2020 19:17:15 -0700 (PDT) Received: from localhost ([2620:15c:6:12:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id g136sm15865246qke.82.2020.08.16.19.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 19:17:15 -0700 (PDT) Date: Sun, 16 Aug 2020 22:17:14 -0400 From: Joel Fernandes To: peterz@infradead.org Cc: linux-kernel@vger.kernel.org, Aaron Lu , Aubrey Li , Julien Desfossez , Kees Cook , "Paul E. McKenney" , Paul Turner , Steven Rostedt , Thomas Gleixner , Tim Chen , Tim Chen , Vincent Guittot , Vineeth Pillai , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , fweisbec@gmail.com, kerrnel@google.com, Phil Auld , Valentin Schneider , Paolo Bonzini , Chen Yu , Christian Brauner Subject: Re: [PATCH RFC 02/12] entry/idle: Add a common function for activites during idle entry/exit Message-ID: <20200817021714.GB1492280@google.com> References: <20200815031908.1015049-1-joel@joelfernandes.org> <20200815031908.1015049-3-joel@joelfernandes.org> <20200815081441.GG2674@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200815081441.GG2674@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Peter, On Sat, Aug 15, 2020 at 10:14:41AM +0200, peterz@infradead.org wrote: > On Fri, Aug 14, 2020 at 11:18:58PM -0400, Joel Fernandes (Google) wrote: > > Currently only RCU hooks for idle entry/exit are called. In later > > patches, kernel-entry protection functionality will be added. > > > > Signed-off-by: Joel Fernandes (Google) > > NAK, rcu_idle_enter() is broken where it is now, it needs to be pushed > in deeper: > > http://lkml.kernel.org/r/20200807193017.962482579@infradead.org Thank you for pointing it out. Not a huge problem, a couple ways I can do it: 1. Move the calls to sched_core_unsafe_{enter,exit}() deeper into the idle loop. 2. Keep the calls to sched_core_unsafe_{enter,exit}() where they are now as in this patch, but leave out the rcu_idle_{enter,exit}() calls alone so they can be moved deeper as you mentioned. #1 is not necessary for these patches to work and might be overkill. I'll go the #2 route then. Let me know any other ideas you might have. What I am trying to do here is to handle a case where task is switching to idle (say it went to sleep) and wakes up later. usermode -> syscall (kernel mode - so mark unsafe) -> idle (mark safe). idle -> syscall wakes (kernel mode - so mark unsafe) -> usermode (mark safe). Thank you, - Joel