From nobody Wed Jan 5 18:19:01 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A05001933EC9; Wed, 5 Jan 2022 18:19:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JTd6H30BDz3q6l; Wed, 5 Jan 2022 18:19:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x834.google.com with SMTP id y17so2394175qtx.9; Wed, 05 Jan 2022 10:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Uy3EUicVDErCZueKOtrkU9AQ/sQ7N+VIfNj342K85q0=; b=JcIbqFM/jcRZPphS6zqg1e+I+Did8d2MaeHTUbfUYbxoGGS4f4HyGXWnUZQIGKp46a cW9bf2ODuV28z9DI8yqp86hkVmmn/TwnCv5zAUEpdUQ9mlo/kLQs+DhyjOxctO3CZBJ8 4UeM1jEth/nkoNLIO0O42Jlcl4pcXER1rFl0mWxFmUrm4f2zO/iLs2StBwJ7ohRqNg48 0Ae2sUHRKHRnKLUcscupcQOTX/GY07raEAJdOT422PwUACNvdYH5MsJPOouBe+fwRkKu aLudGYVfwDBh44o6gmNfmXBPlY1qCYRExPLEvfWjr29qKJsXKs95vru+/jYb1engppwI iNSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Uy3EUicVDErCZueKOtrkU9AQ/sQ7N+VIfNj342K85q0=; b=JJufdh8SpwmeWVJS7WbtVH+OPFFXmUkI3BchRpy6YzzvQjbZkl0LFhwgQymFYDc6Ei ircxbeyLiraE/Ffc4vc+nhPZi3o0Q25VICN8NkOmzUsutMteQtvmFmQ+XPazMRK3Tn+3 sVaL15B9i4kM5+9IPcAoh/fuduUcPRisPrW5bkrEWyUXPiM0sDm//v+qxxB60dFEPvlT 8Jt+7cIVCCwDsC7mZUrqyP6VBs6wBFmSlD9nSyRrkz9+pKxu61PizVGLP8XQiSRe3/hN cF6zhN35RuKfEWYXeZUsCKbsVChQgqESxOtTCqoUKkVDrTuxthOO7QuZwpu8CMAY/VE7 rEkg== X-Gm-Message-State: AOAM531bNUcMvZz8B3P6V5bQHazpwqIgA9DAwk21/KPYxKoVDqNmXl6b jSYCWrouE6fYQbX3kkm+wvPYdyljDsI= X-Google-Smtp-Source: ABdhPJwwrllPPwDOY0cjE6fCwBq0cDJ1Ore5zxSspWxCKK9c6PYVoGCUmx0MqN2aast1je3F/FzgZw== X-Received: by 2002:ac8:5713:: with SMTP id 19mr49667817qtw.642.1641406742689; Wed, 05 Jan 2022 10:19:02 -0800 (PST) Received: from [10.231.1.66] ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id 14sm36779215qtx.84.2022.01.05.10.19.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jan 2022 10:19:02 -0800 (PST) Sender: Alexander Motin Message-ID: Date: Wed, 5 Jan 2022 13:19:01 -0500 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: git: 9e007a88d65b - main - atkbd: Reduce polling rate from 10Hz to ~1Hz. Content-Language: en-US To: Warner Losh Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202201051641.205GfWZV041757@gitrepo.freebsd.org> From: Alexander Motin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4JTd6H30BDz3q6l X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N I saw scenarios with lost edge-triggered MSI interrupts on weird Marvell AHCIs. So I can believe it may be weird for atkbd too, if it is edge-triggered aswell. I haven't looked into its specs for very long time. If you are sure it is not needed, then I have no problem to set it to 0 in separate commit, I've planned that possibility. On 05.01.2022 12:26, Warner Losh wrote: > Maybe we default hw.atkbd.hz to 0. That will give us more info if this > is even a thing still. And it would give users hit by this a no > recompile fix and give us feedback as to how often this happens. > > We used to miss ISA interrupts in the early SMPNG days, and that's the > time this change was introduced. The PIC does a good job of latching the > state and we have no other drivers that have this workaround absent > issues with the device itself. > > Warner > > On Wed, Jan 5, 2022, 9:41 AM Alexander Motin > wrote: > > The branch main has been updated by mav: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=9e007a88d65ba0d23e73c3c052d474a78260d503 > > > commit 9e007a88d65ba0d23e73c3c052d474a78260d503 > Author:     Alexander Motin > AuthorDate: 2022-01-05 16:32:44 +0000 > Commit:     Alexander Motin > CommitDate: 2022-01-05 16:41:26 +0000 > >     atkbd: Reduce polling rate from 10Hz to ~1Hz. > >     In my understanding this is only needed to workaround lost > interrupts. >     I was thinking to remove it completely, but the comment about edge- >     triggered interrupt may be true and needs deeper > investigation.  ~1Hz >     should be often enough to handle the supposedly rare loss > cases, but >     rare enough to not appear in top.  Add sysctl hw.atkbd.hz to > tune it. > >     MFC after:      1 month > --- >  sys/dev/atkbdc/atkbd.c | 15 +++++++++++++-- >  1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c > index 40dd698984e3..cee1207df973 100644 > --- a/sys/dev/atkbdc/atkbd.c > +++ b/sys/dev/atkbdc/atkbd.c > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); >  #include >  #include >  #include > +#include > >  #include >  #include > @@ -73,6 +74,13 @@ typedef struct atkbd_state { >  #endif >  } atkbd_state_t; > > +static SYSCTL_NODE(_hw, OID_AUTO, atkbd, CTLFLAG_RD | > CTLFLAG_MPSAFE, 0, > +    "AT keyboard"); > + > +static int atkbdhz = 1; > +SYSCTL_INT(_hw_atkbd, OID_AUTO, hz, CTLFLAG_RWTUN, &atkbdhz, 0, > +    "Polling frequency (in hz)"); > + >  static void            atkbd_timeout(void *arg); >  static int             atkbd_reset(KBDC kbdc, int flags, int c); > > @@ -198,8 +206,11 @@ atkbd_timeout(void *arg) >                         kbdd_intr(kbd, NULL); >         } >         splx(s); > -       state = (atkbd_state_t *)kbd->kb_data; > -       callout_reset(&state->ks_timer, hz / 10, atkbd_timeout, arg); > +       if (atkbdhz > 0) { > +               state = (atkbd_state_t *)kbd->kb_data; > +               callout_reset_sbt(&state->ks_timer, SBT_1S / atkbdhz, 0, > +                   atkbd_timeout, arg, C_PREL(1)); > +       } >  } > >  /* LOW-LEVEL */ > -- Alexander Motin