[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 6/8] x86/HPET: simplify "expire" check a little in reprogram_hpet_evt_channel()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 22 Jan 2026 11:10:38 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Jxwn6ez9iCqgQgbEK9PUYb4V9q+oTsOG9wl4sbnLa1Q=; b=eV3Q8mqF+bEFwY1KnUp4WyxXHyMN/JmcrbPkASBB18Ql/LKqOfZ0ttza3JA12oKGWqK625ZaXCp7r+mcFsID4Re1dw5rYMNHRaBpoxhF0TfDFG3qHBp9jfm8E1v5N1E5suSHBDCILxefQcHCBHF3okkDxZFzOkoNPJyDByuAeeLyNSChMgCC7a2iHjshFfZABtdTmtE8y6ilxbK3oxMbZ1Po6GW1WJixNI3tw2FSrDVlIQG7t282ILLBqf0/7GJva0Wc1zv9cRL5bD9xiMpNF7UJ1kQvxDZatfw94af7C1+XUGoVfTVVlQnZETiNHkNEAnQdrWJZtzMdMOKdXxxTbg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fQGABl65XVTxAxWnuhVcS5Niia+PHrwJhni50a1OVqs+esAxwD9uz1frUo4NFnoJ/xtgMEpUozAmOdvS2tRA7rlPaHssSVf9hUDYskYgJ7aJtpAjvbPQG9exeJdpTSlUUl+J/89nZq8S4hfgnctRrn1T98w+V2cp/RXUp8d27iYdteAj9qrCKp1YuSruaAe4RvlROQ9nu9hxiBlrTKK5lubg08BaMs8MQUJ8WS1z/zI5plf9Qh2WL/b7e0hXZIoH5aqjq6Nu3kRYYo68CUREh73MpK356fXdEDCGGAZ2ucytDoe5wkbSpc/VO/FYct0Cc4AtvwEs8CYkTvmY3ctxKg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 22 Jan 2026 10:10:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Jan 22, 2026 at 10:28:51AM +0100, Jan Beulich wrote:
> On 22.01.2026 10:18, Roger Pau Monné wrote:
> > On Mon, Nov 17, 2025 at 03:39:30PM +0100, Jan Beulich wrote:
> >> When this was added, the log message was updated correctly, but the zero
> >> case was needlessly checked separately: hpet_broadcast_enter() had a zero
> >> check added at the same time, while handle_hpet_broadcast() can't possibly
> >> pass 0 here anyway.
> >>
> >> Fixes: 7145897cfb81 ("cpuidle: Fix for timer_deadline==0 case")
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> > 
> > Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Thanks.
> 
> > Similar to the previous commit, I wonder whether it would make sense
> > to add an ASSERT_UNREACHABLE() if that error path is not reachable
> > given the logic in the callers.
> 
> That would mean
> 
>     if ( unlikely(expire < 0) )
>     {
>         printk(KERN_DEBUG "reprogram: expire <= 0\n");
>         return -ETIME;
>     }
> 
>     if ( unlikely(expire == 0) )
>     {
>         ASSERT_UNREACHABLE();
>         return -ETIME;
>     }
> 
> which I fear I don't like (for going too far). Even
> 
>     if ( unlikely(expire <= 0) )
>     {
>         printk(KERN_DEBUG "reprogram: expire <= 0\n");
>         ASSERT(expire);
>         return -ETIME;
>     }
> 
> I'd be uncertain about, as that needlessly gives 0 a meaning that isn't
> required anymore in this function.

Hm, OK, I was under the impression that both < 0 and 0 should never be
passed by the callers.  If expire == 0 is a possible input then I
don't think the ASSERT() is that helpful.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.