Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp423864rdb; Thu, 1 Feb 2024 12:25:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIqrpmQG4l4Sj6IJHehvT35iGj+0nhgC+r+tskBfleDTOnvr6fSOgou0kYVYErbspmbX5J X-Received: by 2002:a17:903:124d:b0:1d8:a93f:a5b2 with SMTP id u13-20020a170903124d00b001d8a93fa5b2mr6716141plh.12.1706819140704; Thu, 01 Feb 2024 12:25:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706819140; cv=pass; d=google.com; s=arc-20160816; b=djSlFbFL4hQcavHobu1kRTTfb/UWUnthcnsyh4DmHaQpH1Dlu0ABDRECqQHWkCExra vhORYSe3OYrQxy3Vqo1GsrXE91z0nW62m3/PLEwQqt1HTG4Gdx0yTm+C9V+HzjLOvaNk eshaiGQXl/r/mAZemIc6HleKRk0NvOGQ1VpljxA9W/H9AaIJU3+tQoKGO0fRVJW5F0ep 17JfZdqT/j1Lt3Gi9ze3IKRabSByQLpsdo3Qx2cj7uHSMs8cvpPMwBVi53Puo+pphc1/ ox6Kx4dTObwGWduhqumJ3d6PTc2rRH/pOL3VAde2oAYg+ysM6SuGQ8jilIhKBH8G0081 3khg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iN9wTYAiEZqmVZSRGp3IE12Ur++dFYxvXqv8nbWcyFg=; fh=i9MlaWepwRt3kXDBsOi0NN3QSiql5rc/kvcW0jkqAP8=; b=ChRAzfmxwUOwCrNL3IVPpkJHui/PbrjnaquUe7lnEHtQnlkKo3V/IrMWEwCwI/+uyq JUoM2GiZLuyWjr8QCwMPTtxlHuZHUhyYm0OeIl8+rMA+tdabEgx4J99QcGG1KkSwlSfv y4pmJF+InRTRfaLibJLs6doqezqze5pI8zvqfq6GcIkdwYdySnxxD4YoZlokn+W1Fek2 nfko/TIdCwxI+up/ZCTM2KnCbW5wrmW2ROYr1+pHKt1b7Yos6+v4THaiy7Lb6/q0iJQE 1n3bvy+GimqCRA8K4oedEZcMDwQFJa/StaheiNR+FgPZUdLms8cyz6nYrj3lMCwp/Z0c s3uQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DTRQ4Hna; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-48794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCUATNwK07fHSlWUoMbSvmkzIspVJMZW+ubDgOF3xe4LUgWznQwHCe8h2CBh/uS3QiZZKZy0NhY/SZ/m5MkOhFzWsQnIDymBqRcQ0rkN7Q== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h22-20020a170902ac9600b001d8f27566bfsi326913plr.599.2024.02.01.12.25.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 12:25:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DTRQ4Hna; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-48794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A93A6B2CF9A for ; Thu, 1 Feb 2024 19:56:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33EBC8529F; Thu, 1 Feb 2024 19:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DTRQ4Hna" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE14285286 for ; Thu, 1 Feb 2024 19:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706817377; cv=none; b=W2YRzMs9m251kVrdWuu/qHgW1pV2ABYwbD/DzeqZzbEsaBwJqx66kSee9zwt1scBNwdb4li/sWujcpLpLDb+vyGDn+6dUh+g/Zr3ebVavPalxYcgkr1w4BbVZ9zS45Y2RX1hh2JANlzW0fOjIB479D/eEsvlxlGS5V6JQSfWA98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706817377; c=relaxed/simple; bh=TyvARfG5cdiLS3Lx957Ua1EFLe1TpBHS0WmMWNXQHGg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=InTWaVbt+IAU+dWdH8qX+H8Ug1nMQx1oK8UBjp31EyFXsnkZmATUuNAwC0ooC/V4fRHlFbBIWxWrU0jjmrF5x2eI3aD4pYWDAa5fHPmDaKmjo2MpvP7MHkM/TOQcdpVd/2HNG7Q8hCRaRgZWGtYsbILtcKmLvnD1OT0traoCVSA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DTRQ4Hna; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706817374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iN9wTYAiEZqmVZSRGp3IE12Ur++dFYxvXqv8nbWcyFg=; b=DTRQ4Hnaubahspwx54qtR7ubNcdJwXU4sKmDD/SKuTVJ92bACyRN2QF/mLHMqCxK+X8sFm +5hoDjhjXOUgzDAirYLhJoUp9DydRg7ncYio7FxVq8nrBmZJen7XkEh21adiZ6WKM+k+t6 elDp2D1qSB9OdS3AJgQCoDQauTbkWiw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-2hoVCHGRMSqXp1LTv0T2SA-1; Thu, 01 Feb 2024 14:56:11 -0500 X-MC-Unique: 2hoVCHGRMSqXp1LTv0T2SA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E92FF8489F7; Thu, 1 Feb 2024 19:56:10 +0000 (UTC) Received: from tpad.localdomain (unknown [10.96.133.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B007A2026D66; Thu, 1 Feb 2024 19:56:10 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id CA31C402492AA; Thu, 1 Feb 2024 15:45:01 -0300 (-03) Date: Thu, 1 Feb 2024 15:45:01 -0300 From: Marcelo Tosatti To: Parshuram Sangle Cc: rafael@kernel.org, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, jaishankar.rajendran@intel.com Subject: Re: [PATCH] cpuidle: do not shrink guest poll_limit_ns below grow_start Message-ID: References: <20240111135950.17016-1-parshuram.sangle@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240111135950.17016-1-parshuram.sangle@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 On Thu, Jan 11, 2024 at 07:29:50PM +0530, Parshuram Sangle wrote: > While adjusting guest halt poll limit, grow block starts at > guest_halt_poll_grow_start without taking intermediate values. > Similar behavior is expected while shrinking the value. This > avoids short interval values which are really not required. > > VCPU1 trace (guest_halt_poll_shrink equals 2): > > VCPU1 grow 10000 > VCPU1 shrink 5000 > VCPU1 shrink 2500 > VCPU1 shrink 1250 > VCPU1 shrink 625 > VCPU1 shrink 312 > VCPU1 shrink 156 > VCPU1 shrink 78 > VCPU1 shrink 39 > VCPU1 shrink 19 > VCPU1 shrink 9 > VCPU1 shrink 4 > > Similar change is done in KVM halt poll flow with below patch: > Link: https://lore.kernel.org/kvm/20211006133021.271905-3-sashal@kernel.org/ > > Co-developed-by: Rajendran Jaishankar > Signed-off-by: Rajendran Jaishankar > Signed-off-by: Parshuram Sangle > --- > drivers/cpuidle/governors/haltpoll.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpuidle/governors/haltpoll.c b/drivers/cpuidle/governors/haltpoll.c > index 1dff3a52917d..663b7f164d20 100644 > --- a/drivers/cpuidle/governors/haltpoll.c > +++ b/drivers/cpuidle/governors/haltpoll.c > @@ -98,10 +98,15 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns) > unsigned int shrink = guest_halt_poll_shrink; > > val = dev->poll_limit_ns; > - if (shrink == 0) > + if (shrink == 0) { > val = 0; > - else > + } else { > val /= shrink; > + /* Reset value to 0 if shrunk below grow_start */ > + if (val < guest_halt_poll_grow_start) > + val = 0; > + } > + > trace_guest_halt_poll_ns_shrink(val, dev->poll_limit_ns); > dev->poll_limit_ns = val; > } > -- > 2.17.1 > > > Looks good. Reviewed-by: Marcelo Tosatti