Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2943652ybt; Mon, 22 Jun 2020 10:50:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/IU9aon4iaL74ZepkHpyx/KGqxY79zFp6xtA63wjTpZTQRBgeVEFZOEvVF6MjfK+exli0 X-Received: by 2002:a17:906:7f95:: with SMTP id f21mr16351378ejr.554.1592848241529; Mon, 22 Jun 2020 10:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592848241; cv=none; d=google.com; s=arc-20160816; b=qV94p9RTqO2WENH3BxrML4wpHlX25T1vagj+ajP4HTRP+mH7H3HvuzyetCSueBYyVM AhPOGCsXq0ma6QL6SQqMs8FISaqSvP/F+s7cuRmNu3eEaRup9zn+pYboqtRypn9feC1f TM1ZH4kFwXI+NN2SfnSfOCi4E7oV6TBbEzya8e2bLuP1BZGcRBQDwEq/7QuqxK+Kwhm/ ucnUoHjb9xgVeGHBPspUzzDdGoPuLMKbogX4hS3OjazhNhF82j5ZZ3X6mwKuNnTCsi8v 0XoaSgWj4ygN6aPj86rbD0Z0poaOllEMTA8mP6m91OqYILgmcDpiCOQO+PpQy2LBK8dV hTBA== 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=D6RYs2e9cp/tiQdgjUAxoJL7fGpw4g7U5+v8QSSYE+o=; b=G7QEGiH5sEBAJlx8Ngud6eqLGox2T0XFD27kPylYyukKvO95h0ns6iE1uPv93vov6/ itiJZxya7tVj370RxRFhBE0z30u18v57IZrHC80bS6WDP+h5w0t2hEJQJGWFvcq3hcGR Xhx8b1p/5AiGOAyhTNFEJ9Vkkfi6TuYfwNRr7lBkaVf8f23Q909jzjl/LrIITLwDoQ+v FFSxBEVm9+5JVAIYjOPgHT/G0WRqbT3J8+rIXUwXOTKZg7ZNx5wcXDkvq2PtgH83ox3b piMIUUIDSFG3yBCJRfS3l8PnGcaz+DoWo7CUvUGreZCKymybSuQU2jiNUYtD9yIu5VpJ 56yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=RXfsOigM; 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 oz40si1470200ejb.432.2020.06.22.10.50.18; Mon, 22 Jun 2020 10:50:41 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=RXfsOigM; 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 S1730118AbgFVRs1 (ORCPT + 99 others); Mon, 22 Jun 2020 13:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730049AbgFVRs0 (ORCPT ); Mon, 22 Jun 2020 13:48:26 -0400 X-Greylist: delayed 1106 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 22 Jun 2020 10:48:26 PDT Received: from casper.infradead.org (unknown [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6950BC061573; Mon, 22 Jun 2020 10:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=D6RYs2e9cp/tiQdgjUAxoJL7fGpw4g7U5+v8QSSYE+o=; b=RXfsOigMRTty6ZaUB7G7FJXMVv f25gQtP8ZWeaSDC+T5BEBziK6Qh4jMqv7/yXp5g4o8UmkRbxLdwJYNaNFJfIRMg7zjUXLSCZGN9EM gG+8rXX5LSu9ON0+l2oEWIigdXmqsFyPlhm5QqDR7g3jwUmX5n8kUxQORnFwNBhQxMNprfcSJriAw hVzpLG+h6Vy7bKHRWV5UEYvQSv7lwH5ehd3ZopU0YBF3V3Wn6/eLHBKvajKBA92GZYQS4D3Z8qTA4 xRMwmxXNh+EPPMfIrbNeYlK0ibTwUCc+YNrvYYHNL5UpMcrGEF018JN3NIihc7SYAdAcqaq8zMD2b 9XLyQ7Ew==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnQGJ-00027e-Fr; Mon, 22 Jun 2020 17:29:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0050E303DA8; Mon, 22 Jun 2020 19:29:36 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B6CE12B6335C0; Mon, 22 Jun 2020 19:29:36 +0200 (CEST) Date: Mon, 22 Jun 2020 19:29:36 +0200 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Chen Yu , Len Brown , Daniel Lezcano , Ingo Molnar , Linux PM , Linux Kernel Mailing List , Rui Zhang Subject: Re: [PATCH][v2] PM / s2idle: Clear _TIF_POLLING_NRFLAG before suspend to idle Message-ID: <20200622172936.GA4781@hirez.programming.kicks-ass.net> References: <20200616040442.21515-1-yu.c.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 06:19:35PM +0200, Rafael J. Wysocki wrote: > > Fixes: b2a02fc43a1f ("smp: Optimize send_call_function_single_ipi()") > > Suggested-by: Peter Zijlstra (Intel) > > Reported-by: kbuild test robot > > Cc: "Rafael J. Wysocki" > > Cc: Len Brown > > Cc: Peter Zijlstra (Intel) > > Signed-off-by: Chen Yu > > Peter, any more comments here? Only that the whole s2idle stuff could do with a cleanup :-) > > +static int call_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev, > > + int index) > > +{ > > + if (!current_clr_polling_and_test()) > > + s2idle_enter(drv, dev, index); > > + > > + return index; > > Is the value returned here used at all? > > > +} > > + > > /** > > * cpuidle_enter_s2idle - Enter an idle state suitable for suspend-to-idle. > > * @drv: cpuidle driver for the given CPU. > > @@ -187,7 +197,7 @@ int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev) > > */ > > index = find_deepest_state(drv, dev, U64_MAX, 0, true); > > if (index > 0) > > - enter_s2idle_proper(drv, dev, index); > > + call_s2idle(drv, dev, index); > > I'm wondering why this can't be > > if (index > 0 && !current_clr_polling_and_test()) > enter_s2idle_proper(drv, dev, index); Works for me. Some Wysocki guy wrote much of it, best ask him :-) The thing that confused me is that all this is way different from the normal idle path and didn't keep the invariants. Ideally; much of that gets folded back into the normal patch somehow.