Attending Gitex ?

2022-10-27 Thread einvoicing
Dear Valued customer,
I’ve been speaking to a lot of our customers and something I’ve been hearing 
consistently is that manual and paper-based processes continue to limit cost 
optimization efforts, decrease team productivity, and hold back growth.
That’s why this Gitex, we’re partnering with Nintex to help our customers 
discover which processes are holding back strategic initiatives, develop an 
automation roadmap and automate even the most complicated manual processes.* 
Whether IT, Finance, HR or operational processes, they’ve helped leading 
organizations including UAE Ministry of Interior, Public Investment Fund ( 
Saudi Arabia), Khalifa University and Oman Arab Bank, conquer manual processes 
and improve efficiency.
Together with Nintex, we’ll be providing a number of activities including 
process discovery demos, industry and role focused process automation talks to 
one-on-one consultation with world class process automation experts and case 
study discussions to provide you with all the resources you need to design and 
plan your automation roadmap.*
I’d love to personally host you next month. What day will you be at Gitex, and 
would it be worth a quick 30-minute meeting to discuss how automating manual 
processes can help you accelerate progress on your business priorities?   You 
can also request a meeting here [1]

at ARMS
- Nintex: GITEX 2022 [2]
*
Best Regards
Sales Manager
* ARMS IT - sa...@armsit.com *

Unsubscribe [3]




[1] 
http://url6498.armsit.com/ls/click?upn=BXqOu0kOttjRu3UnUAt5Ay0oNghjDsq9JKLUBU7POrdPv4jKTwnkM5dJFieDBhLkcramfEUC3VwvmWhKg3MAZA-3D-3DyD_T_-2B8rDeUnZs6T4iEYkzOVw1Bza1KPpw3YcM3rG5h56ykH9juOrmaWmYgPDoCQzEnSYsOvJzDx4q4ajB9UFHTNT3gNj1gJEV8RRdl3GS0lrVxoVe6-2FGSAbJoCw1Alxs5NK4k4UVctjv1y6fPrIzX302Bg8zQ4m5hHDUcnFbGbuX2Eukkn9BtKXG0EtKJFIMd5VTPh-2FdhRJn6voSCzkMuySmog-3D-3D
[2] 
http://url6498.armsit.com/ls/click?upn=BXqOu0kOttjRu3UnUAt5Ay0oNghjDsq9JKLUBU7POrdPv4jKTwnkM5dJFieDBhLkcramfEUC3VwvmWhKg3MAZA-3D-3D4NXb_-2B8rDeUnZs6T4iEYkzOVw1Bza1KPpw3YcM3rG5h56ykH9juOrmaWmYgPDoCQzEnSYH97HNwjQYnSwdb2iF8Qs8MV-2FL2tUKttOX9o696PHOjyh0O5YlU-2Fqh1AIdNaRm-2Bo0BD3C4q6d2iYuyDEhFHF-2B9lvDttcHX8-2FDKseZuuWeEUrFjbqbtTgJPTbHOvxnAk4XRV3D2GU8bdeQGUBWInomWQ-3D-3D
[3] 
http://url6498.armsit.com/ls/click?upn=BXqOu0kOttjRu3UnUAt5Ay0oNghjDsq9JKLUBU7POrcQ4-2BbxogBblfxwbNmF9JbBJX6X0i5iW7-2Be2C5qUWVkpQ-3D-3DECvy_-2B8rDeUnZs6T4iEYkzOVw1Bza1KPpw3YcM3rG5h56ykH9juOrmaWmYgPDoCQzEnSYeUAosHAPTJFKkZuYaacpl2UFZ1-2FaF-2FZDfUJK78gMpz09KO4FKytG0RjPt1aJPEmvYP9r9HHOubbKMSrhT0bcA-2BxiThHrF3SrKEmJ8m8q2on3G-2FK1R0VsSTYXMixuClxGlpw98PE-2F5NfEIvmnCRS9Tw-3D-3D


Re: [Patch] add minor clarification to Wireless in faq/faq6.html

2022-10-27 Thread tux2bsd
> On Thu, Oct 27, 2022 at 08:09:17AM +, tux2bsd wrote:
> 
> > This patch is to add a brief note that 'nwid' 
> > & 'join' serve different purposes and which 
> > man page to consult.
> > 

Stefan Sperling wrote:
> The FAQ exists for  people who want to read a 
> distilled version of the most important bits of 
> information to get them going. 

Correct.  I wasn't asking any questions above.

Trying to submit an earlier patch to the right list.

History:

https://marc.info/?l=openbsd-misc=166608360909995=2

tux2bsd



Re: Replace audio(9) get_props() with duplex check in open() for play-only drivers

2022-10-27 Thread Mark Kettenis
> Date: Thu, 27 Oct 2022 13:27:43 +
> From: Klemens Nanni 
> 
> Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
> in their open() if full-duplex mode was requested.
> 
> This way, sys/dev/audio.c:audio_open() will fail immediately rather than
> later through the to-be-removed get_props() check.
> 
> These are all drivers which simply don't support recording.
> 
> In device-tree based drivers like simpleaudio(4)/rkiis(4) and newer
> Apple ones like aplaudio(4)/aplmca(4), this adds a new open() stub to
> the low-level drivers which merely does the duplex check.
> 
> The rkiis(4) and aplmca(4) stubs don't open anything, but are now
> required for simpleaudio(4) and aplaudio(4) to actually do the low-level
> driver specific duplex check.
> 
> My Pinebook Pro keeps playing audio and recording silence with this diff
> just like before (rkiis(4) is currently play-only):
>   simpleaudio0 at mainbus0
>   simpleaudio1 at mainbus0
>   audio0 at simpleaudio1
> 
>   $ aucat -i song69.wav -o rec.wav
> 
> Builds fine on amd64 and arm64.
> Feedback? Objection? OK?

Sorry, but I'm still not sure I understand how this is supposed to
work.  Because...

> ---
>  sys/arch/arm64/dev/aplaudio.c  | 15 ---
>  sys/arch/arm64/dev/aplmca.c| 20 
>  sys/arch/luna88k/cbus/nec86.c  |  1 -
>  sys/arch/luna88k/cbus/nec86hw.c| 10 --
>  sys/arch/luna88k/cbus/nec86hwvar.h |  2 --
>  sys/dev/fdt/graphaudio.c   | 15 ---
>  sys/dev/fdt/rkiis.c| 20 +++-
>  sys/dev/fdt/simpleaudio.c  | 15 ---
>  sys/dev/ic/arcofi.c| 11 +++
>  sys/dev/pci/maestro.c  | 13 +++--
>  10 files changed, 33 insertions(+), 89 deletions(-)
> 
> diff --git a/sys/arch/arm64/dev/aplaudio.c b/sys/arch/arm64/dev/aplaudio.c
> index 2e06448a882..49b0aac2f38 100644
> --- a/sys/arch/arm64/dev/aplaudio.c
> +++ b/sys/arch/arm64/dev/aplaudio.c
> @@ -55,7 +55,6 @@ voidaplaudio_freem(void *, void *, int);
>  int  aplaudio_set_port(void *, mixer_ctrl_t *);
>  int  aplaudio_get_port(void *, mixer_ctrl_t *);
>  int  aplaudio_query_devinfo(void *, mixer_devinfo_t *);
> -int  aplaudio_get_props(void *);
>  int  aplaudio_round_blocksize(void *, int);
>  size_t   aplaudio_round_buffersize(void *, int, size_t);
>  int  aplaudio_trigger_output(void *, void *, void *, int,
> @@ -74,7 +73,6 @@ const struct audio_hw_if aplaudio_hw_if = {
>   .set_port = aplaudio_set_port,
>   .get_port = aplaudio_get_port,
>   .query_devinfo = aplaudio_query_devinfo,
> - .get_props = aplaudio_get_props,
>   .round_blocksize = aplaudio_round_blocksize,
>   .round_buffersize = aplaudio_round_buffersize,
>   .trigger_output = aplaudio_trigger_output,
> @@ -401,19 +399,6 @@ aplaudio_query_devinfo(void *cookie, mixer_devinfo_t 
> *dip)
>   return ENXIO;
>  }
>  
> -int
> -aplaudio_get_props(void *cookie)
> -{
> - struct aplaudio_softc *sc = cookie;
> - struct dai_device *dai = sc->sc_dai_cpu;
> - const struct audio_hw_if *hwif = dai->dd_hw_if;
> -
> - if (hwif->get_props)
> - return hwif->get_props(dai->dd_cookie);
> -
> - return 0;
> -}
> -
>  int
>  aplaudio_round_blocksize(void *cookie, int block)
>  {
> diff --git a/sys/arch/arm64/dev/aplmca.c b/sys/arch/arm64/dev/aplmca.c
> index 559dd765933..0d323ffc0c6 100644
> --- a/sys/arch/arm64/dev/aplmca.c
> +++ b/sys/arch/arm64/dev/aplmca.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -123,11 +124,11 @@ struct aplmca_softc {
>  int  aplmca_set_format(void *, uint32_t, uint32_t, uint32_t);
>  int  aplmca_set_sysclk(void *, uint32_t);
>  
> +int  aplmca_open(void *, int);
>  int  aplmca_set_params(void *, int, int,
>   struct audio_params *, struct audio_params *);
>  void *aplmca_allocm(void *, int, size_t, int, int);
>  void aplmca_freem(void *, void *, int);
> -int  aplmca_get_props(void *);
>  int  aplmca_trigger_output(void *, void *, void *, int,
>   void (*)(void *), void *, struct audio_params *);
>  int  aplmca_trigger_input(void *, void *, void *, int,
> @@ -136,8 +137,8 @@ int   aplmca_halt_output(void *);
>  int  aplmca_halt_input(void *);
>  
>  const struct audio_hw_if aplmca_hw_if = {
> + .open = aplmca_open,
>   .set_params = aplmca_set_params,
> - .get_props = aplmca_get_props,
>   .allocm = aplmca_allocm,
>   .freem = aplmca_freem,
>   .trigger_output = aplmca_trigger_output,
> @@ -380,6 +381,15 @@ aplmca_set_sysclk(void *cookie, uint32_t rate)
>   return clock_set_frequency_idx(sc->sc_node, ad->ad_cluster, rate);
>  }
>  
> +int
> +aplmca_open(void *cookie, int flags)
> +{
> + if (flags & (FWRITE | FREAD))
> + return ENXIO;

Doesn't this mean that you return ENXIO even if only playback is
requested?  Because then flags would still contain 

Re: bgplgd show pid in more debug messages

2022-10-27 Thread Theo Buehler
On Thu, Oct 27, 2022 at 03:11:11PM +0200, Claudio Jeker wrote:
> Trying to figure out why bgplgd terminates sometimes.
> Since there is a timeout firing at an unexpected time I want some extra
> info to figure out what kind of race this is.

Sure, ok

> 
> -- 
> :wq Claudio
> 
> Index: slowcgi.c
> ===
> RCS file: /cvs/src/usr.sbin/bgplgd/slowcgi.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 slowcgi.c
> --- slowcgi.c 25 Aug 2022 16:49:18 -  1.4
> +++ slowcgi.c 27 Oct 2022 13:01:20 -
> @@ -505,7 +505,7 @@ slowcgi_timeout(int fd, short events, vo
>   if (c->script_flags & SCRIPT_DONE)
>   return;
>  
> - ldebug("timeout fired");
> + ldebug("timeout fired for pid %d", c->command_pid);
>  
>   if (c->timeout_fired)
>   sig = SIGKILL;
> @@ -556,7 +556,7 @@ slowcgi_sig_handler(int sig, short event
>   else
>   c->command_status = WEXITSTATUS(status);
>  
> - ldebug("exit %s%d",
> + ldebug("pid %d exit %s%d", pid,
>   WIFSIGNALED(status) ? "signal " : "",
>   c->command_status);
>  
> 



Re: Replace audio(9) get_props() with duplex check in open() in partial-duplex drivers

2022-10-27 Thread Klemens Nanni


27 Oct 2022 17:31:45 Miod Vallat :

> Wait, this is wrong. All your
> 
>     (flags & (FWRITE | FREAD))
> 
> comparisons must be
> 
>     ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
> 
> in order to truly catch full-duplex opens. Otherwise the condition will
> always be satisfied since one of FREAD or FWRITE will always be set...
Wrong set of sed'ed diffs, sorry.
Will resend the right ones later.



Replace audio(9) get_props() with duplex check in open() for play-only drivers

2022-10-27 Thread Klemens Nanni
Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
in their open() if full-duplex mode was requested.

This way, sys/dev/audio.c:audio_open() will fail immediately rather than
later through the to-be-removed get_props() check.

These are all drivers which simply don't support recording.

In device-tree based drivers like simpleaudio(4)/rkiis(4) and newer
Apple ones like aplaudio(4)/aplmca(4), this adds a new open() stub to
the low-level drivers which merely does the duplex check.

The rkiis(4) and aplmca(4) stubs don't open anything, but are now
required for simpleaudio(4) and aplaudio(4) to actually do the low-level
driver specific duplex check.

My Pinebook Pro keeps playing audio and recording silence with this diff
just like before (rkiis(4) is currently play-only):
simpleaudio0 at mainbus0
simpleaudio1 at mainbus0
audio0 at simpleaudio1

$ aucat -i song69.wav -o rec.wav

Builds fine on amd64 and arm64.
Feedback? Objection? OK?
---
 sys/arch/arm64/dev/aplaudio.c  | 15 ---
 sys/arch/arm64/dev/aplmca.c| 20 
 sys/arch/luna88k/cbus/nec86.c  |  1 -
 sys/arch/luna88k/cbus/nec86hw.c| 10 --
 sys/arch/luna88k/cbus/nec86hwvar.h |  2 --
 sys/dev/fdt/graphaudio.c   | 15 ---
 sys/dev/fdt/rkiis.c| 20 +++-
 sys/dev/fdt/simpleaudio.c  | 15 ---
 sys/dev/ic/arcofi.c| 11 +++
 sys/dev/pci/maestro.c  | 13 +++--
 10 files changed, 33 insertions(+), 89 deletions(-)

diff --git a/sys/arch/arm64/dev/aplaudio.c b/sys/arch/arm64/dev/aplaudio.c
index 2e06448a882..49b0aac2f38 100644
--- a/sys/arch/arm64/dev/aplaudio.c
+++ b/sys/arch/arm64/dev/aplaudio.c
@@ -55,7 +55,6 @@ void  aplaudio_freem(void *, void *, int);
 intaplaudio_set_port(void *, mixer_ctrl_t *);
 intaplaudio_get_port(void *, mixer_ctrl_t *);
 intaplaudio_query_devinfo(void *, mixer_devinfo_t *);
-intaplaudio_get_props(void *);
 intaplaudio_round_blocksize(void *, int);
 size_t aplaudio_round_buffersize(void *, int, size_t);
 intaplaudio_trigger_output(void *, void *, void *, int,
@@ -74,7 +73,6 @@ const struct audio_hw_if aplaudio_hw_if = {
.set_port = aplaudio_set_port,
.get_port = aplaudio_get_port,
.query_devinfo = aplaudio_query_devinfo,
-   .get_props = aplaudio_get_props,
.round_blocksize = aplaudio_round_blocksize,
.round_buffersize = aplaudio_round_buffersize,
.trigger_output = aplaudio_trigger_output,
@@ -401,19 +399,6 @@ aplaudio_query_devinfo(void *cookie, mixer_devinfo_t *dip)
return ENXIO;
 }
 
-int
-aplaudio_get_props(void *cookie)
-{
-   struct aplaudio_softc *sc = cookie;
-   struct dai_device *dai = sc->sc_dai_cpu;
-   const struct audio_hw_if *hwif = dai->dd_hw_if;
-
-   if (hwif->get_props)
-   return hwif->get_props(dai->dd_cookie);
-
-   return 0;
-}
-
 int
 aplaudio_round_blocksize(void *cookie, int block)
 {
diff --git a/sys/arch/arm64/dev/aplmca.c b/sys/arch/arm64/dev/aplmca.c
index 559dd765933..0d323ffc0c6 100644
--- a/sys/arch/arm64/dev/aplmca.c
+++ b/sys/arch/arm64/dev/aplmca.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -123,11 +124,11 @@ struct aplmca_softc {
 intaplmca_set_format(void *, uint32_t, uint32_t, uint32_t);
 intaplmca_set_sysclk(void *, uint32_t);
 
+intaplmca_open(void *, int);
 intaplmca_set_params(void *, int, int,
struct audio_params *, struct audio_params *);
 void   *aplmca_allocm(void *, int, size_t, int, int);
 void   aplmca_freem(void *, void *, int);
-intaplmca_get_props(void *);
 intaplmca_trigger_output(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
 intaplmca_trigger_input(void *, void *, void *, int,
@@ -136,8 +137,8 @@ int aplmca_halt_output(void *);
 intaplmca_halt_input(void *);
 
 const struct audio_hw_if aplmca_hw_if = {
+   .open = aplmca_open,
.set_params = aplmca_set_params,
-   .get_props = aplmca_get_props,
.allocm = aplmca_allocm,
.freem = aplmca_freem,
.trigger_output = aplmca_trigger_output,
@@ -380,6 +381,15 @@ aplmca_set_sysclk(void *cookie, uint32_t rate)
return clock_set_frequency_idx(sc->sc_node, ad->ad_cluster, rate);
 }
 
+int
+aplmca_open(void *cookie, int flags)
+{
+   if (flags & (FWRITE | FREAD))
+   return ENXIO;
+
+   return 0;
+}
+
 int
 aplmca_set_params(void *cookie, int setmode, int usemode,
 struct audio_params *play, struct audio_params *rec)
@@ -396,12 +406,6 @@ aplmca_set_params(void *cookie, int setmode, int usemode,
return 0;
 }
 
-int
-aplmca_get_props(void *cookie)
-{
-   return 0;
-}
-
 void *
 aplmca_allocm(void *cookie, int direction, size_t size, int type,
 int flags)
diff --git a/sys/arch/luna88k/cbus/nec86.c 

Re: Replace audio(9) get_props() with duplex check in open() for record-only drivers

2022-10-27 Thread Alexandre Ratchov
On Thu, Oct 27, 2022 at 01:09:57PM +, Klemens Nanni wrote:
> @@ -1859,6 +1857,9 @@ utvfu_audio_open(void *v, int flags)
>   if (usbd_is_dying(sc->sc_udev))
>   return (EIO);
>  
> + if ((flags & (FWRITE | FREAD)))
> + return (ENXIO);
> +
>   if ((flags & FWRITE))
>   return (ENXIO);
>  

We already return ENXIO if playback is requested, so no need for the
additional full-duplex check



Re: Replace audio(9) get_props() with duplex check in open() in partial-duplex drivers

2022-10-27 Thread Alexandre Ratchov
On Thu, Oct 27, 2022 at 01:08:57PM +, Klemens Nanni wrote:
> @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
>  
>   DPRINTF(("ad1848_open: sc=%p\n", sc));
>  
> + if ((flags & (FWRITE | FREAD)) && sc->mode != 2)
> + return ENXIO;
> +
>   sc->sc_pintr = sc->sc_parg = NULL;
>   sc->sc_rintr = sc->sc_rarg = NULL;
>  

afaiu, the correct condition for full-duplex check is:

if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
...

(both FWRITE and FREAD set)

> @@ -982,6 +980,15 @@ essattach(struct ess_softc *sc)
>   * Various routines to interface to higher level audio driver
>   */
>  
> +int
> +ess_1788_open(void *addr, int flags)
> +{
> + if (flags & (FWRITE | FREAD))
> + return ENXIO;
> +
> + return ess_open(addr, flags);
> +}
> +
>  int
>  ess_open(void *addr, int flags)
>  {
> @@ -2059,18 +2066,6 @@ ess_round_buffersize(void *addr, int direction, size_t 
> size)

same here.

> @@ -307,6 +305,9 @@ gusopen(void *addr, int flags)
>  
>   DPRINTF(("gusopen() called\n"));
>  
> + if ((flags & (FWRITE | FREAD)) && sc->sc_recdrq == sc->sc_drq)
> + return ENXIO;
> +
>   if (sc->sc_flags & GUS_OPEN)
>   return EBUSY;
>  

ditto

> @@ -2132,6 +2126,8 @@ sbdsp_midi_open(void *addr, int flags, void 
> (*iintr)(void *, int),
>  
>  DPRINTF(("sbdsp_midi_open: sc=%p\n", sc));
>  
> + if ((flags & (FWRITE | FREAD)) && !sc->sc_fullduplex)
> + return ENXIO;

ditto



Re: Replace audio(9) get_props() with duplex check in open() for play-only drivers

2022-10-27 Thread Alexandre Ratchov
On Thu, Oct 27, 2022 at 01:27:43PM +, Klemens Nanni wrote:
> Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
> in their open() if full-duplex mode was requested.
> 
> This way, sys/dev/audio.c:audio_open() will fail immediately rather than
> later through the to-be-removed get_props() check.
> 
> These are all drivers which simply don't support recording.
> 
> In device-tree based drivers like simpleaudio(4)/rkiis(4) and newer
> Apple ones like aplaudio(4)/aplmca(4), this adds a new open() stub to
> the low-level drivers which merely does the duplex check.
> 
> The rkiis(4) and aplmca(4) stubs don't open anything, but are now
> required for simpleaudio(4) and aplaudio(4) to actually do the low-level
> driver specific duplex check.
> 
> My Pinebook Pro keeps playing audio and recording silence with this diff
> just like before (rkiis(4) is currently play-only):
>   simpleaudio0 at mainbus0
>   simpleaudio1 at mainbus0
>   audio0 at simpleaudio1
> 
>   $ aucat -i song69.wav -o rec.wav
> 
> Builds fine on amd64 and arm64.
> Feedback? Objection? OK?

IMO, for play-only drivers, the check should be:

if (flags & FREAD)
return ENXIO;

which will reject record-only and full-duplex.



Re: bgplgd timeout race

2022-10-27 Thread Theo Buehler
On Thu, Oct 27, 2022 at 04:13:24PM +0200, Claudio Jeker wrote:
> So the timeout for each request is started when the command is accepted
> but the actual fork and exec of bgpctl happens later. So command_pid can
> be 0 when the timeout fires. In that case do not kill ourself but instead
> just abort this command.
> 
> I think this is the proper way to do this dance. Not sure how to really
> test this though.

The explanation and the diff certainly make sense to me.

ok tb (fwiw)

> -- 
> :wq Claudio
> 
> Index: slowcgi.c
> ===
> RCS file: /cvs/src/usr.sbin/bgplgd/slowcgi.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 slowcgi.c
> --- slowcgi.c 27 Oct 2022 13:24:22 -  1.5
> +++ slowcgi.c 27 Oct 2022 14:00:52 -
> @@ -159,6 +159,7 @@ void  parse_begin_request(uint8_t *, uin
>  void parse_params(uint8_t *, uint16_t, struct request *, uint16_t);
>  void parse_stdin(uint8_t *, uint16_t, struct request *, uint16_t);
>  char *env_get(struct request *, const char *);
> +void error_response(struct request *, int);
>  void exec_cgi(struct request *);
>  void script_std_in(int, short, void *);
>  void script_err_in(int, short, void *);
> @@ -505,6 +506,12 @@ slowcgi_timeout(int fd, short events, vo
>   if (c->script_flags & SCRIPT_DONE)
>   return;
>  
> + if (c->command_pid == 0) {
> + c->command_status = SIGALRM;
> + error_response(c, 408);
> + return;
> + }
> +
>   ldebug("timeout fired for pid %d", c->command_pid);
>  
>   if (c->timeout_fired)
> @@ -887,7 +894,7 @@ http_error(int *res)
>   return "Internal Server Error";
>  }
>  
> -static void
> +void
>  error_response(struct request *c, int res)
>  {
>   const char *type = "text/html";
> 



Re: [acpi] patch to run _INI methods before table devices attach

2022-10-27 Thread Mikhail
On Sat, Oct 22, 2022 at 01:41:23PM +0200, Mark Kettenis wrote:
> Identifying which of the "table-driven" device attachments is the
> culprit here might help.

I have following tables:

acpi0: tables DSDT FACP UEFI SSDT SSDT SSDT SSDT SSDT SSDT TPM2 MSDM NHLT SSDT 
LPIT WSMT SSDT SSDT DBGP DBG2 ECDT HPET APIC MCFG SSDT DMAR SSDT SSDT FPDT PTDT 
BGRT

if I run

aml_find_node(sc->sc_root, "_INI", acpi_inidev, sc);

here:
DSDT FACP UEFI SSDT SSDT SSDT SSDT SSDT SSDT TPM2 MSDM NHLT SSDT LPIT WSMT SSDT 
SSDT DBGP DBG2 ECDT HPET APIC MCFG SSDT DMAR SSDT SSDT FPDT PTDT BGRT
^
brightness keys works, if here (right before ECDT):

DSDT FACP UEFI SSDT SSDT SSDT SSDT SSDT SSDT TPM2 MSDM NHLT SSDT LPIT WSMT SSDT 
SSDT DBGP DBG2 ECDT HPET APIC MCFG SSDT DMAR SSDT SSDT FPDT PTDT BGRT

  ^

still works, but if I run it here (after ECDT):


DSDT FACP UEFI SSDT SSDT SSDT SSDT SSDT SSDT TPM2 MSDM NHLT SSDT LPIT WSMT SSDT 
SSDT DBGP DBG2 ECDT HPET APIC MCFG SSDT DMAR SSDT SSDT FPDT PTDT BGRT

   ^
it doesn't work.



Replace audio(9) get_props() with duplex check in open() in partial-duplex drivers

2022-10-27 Thread Klemens Nanni
Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
in their open() if full-duplex mode was requested.

This way, sys/dev/audio.c:audio_open() will fail immediately rather than
later through the to-be-removed get_props() check.

This is the first round for drivers with logic in their get_props(),
i.e. those that only support full-duplex mode for specific hardware:

ess(4), gus(4), pas(4) and sb(4)

All of these are i386/GENERIC only and share code through
sys/dev/isa/{ad1848,sbdsp}{.c,var.h} which is not used by any other
architecture/kernel configuration.

i386/GENERIC.MP builds and boots with this diff.
Feedback? Objection? OK?
---
 sys/dev/isa/ad1848.c| 12 
 sys/dev/isa/ad1848var.h |  2 --
 sys/dev/isa/ess.c   | 29 -
 sys/dev/isa/gus.c   | 19 +++
 sys/dev/isa/gusvar.h|  2 --
 sys/dev/isa/pas.c   |  1 -
 sys/dev/isa/sb.c|  1 -
 sys/dev/isa/sbdsp.c | 10 +++---
 sys/dev/isa/sbdspvar.h  |  2 --
 9 files changed, 22 insertions(+), 56 deletions(-)

diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c
index bb2b95277a1..843af8f3b0d 100644
--- a/sys/dev/isa/ad1848.c
+++ b/sys/dev/isa/ad1848.c
@@ -74,6 +74,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
 
DPRINTF(("ad1848_open: sc=%p\n", sc));
 
+   if ((flags & (FWRITE | FREAD)) && sc->mode != 2)
+   return ENXIO;
+
sc->sc_pintr = sc->sc_parg = NULL;
sc->sc_rintr = sc->sc_rarg = NULL;
 
@@ -1458,11 +1462,3 @@ ad1848_round(void *addr, int direction, size_t size)
size = MAX_ISADMA;
return size;
 }
-
-int
-ad1848_get_props(void *addr)
-{
-   struct ad1848_softc *sc = addr;
-
-   return (sc->mode == 2 ? AUDIO_PROP_FULLDUPLEX : 0);
-}
diff --git a/sys/dev/isa/ad1848var.h b/sys/dev/isa/ad1848var.h
index 49c199f64fc..c8af3f04b4b 100644
--- a/sys/dev/isa/ad1848var.h
+++ b/sys/dev/isa/ad1848var.h
@@ -210,6 +210,4 @@ void   *ad1848_malloc(void *, int, size_t, int, int);
 void   ad1848_free(void *, void *, int);
 size_t ad1848_round(void *, int, size_t);
 
-intad1848_get_props(void *);
-
 #endif
diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c
index 8989dd94b01..51ecd05f12a 100644
--- a/sys/dev/isa/ess.c
+++ b/sys/dev/isa/ess.c
@@ -74,6 +74,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -115,6 +116,7 @@ struct audio_params ess_audio_default =
 
 intess_setup_sc(struct ess_softc *, int);
 
+intess_1788_open(void *, int);
 intess_open(void *, int);
 void   ess_1788_close(void *);
 void   ess_1888_close(void *);
@@ -148,8 +150,6 @@ size_t  ess_round_buffersize(void *, int, size_t);
 
 
 intess_query_devinfo(void *, mixer_devinfo_t *);
-intess_1788_get_props(void *);
-intess_1888_get_props(void *);
 
 void   ess_speaker_on(struct ess_softc *);
 void   ess_speaker_off(struct ess_softc *);
@@ -198,7 +198,7 @@ static const char *essmodel[] = {
  */
 
 const struct audio_hw_if ess_1788_hw_if = {
-   .open = ess_open,
+   .open = ess_1788_open,
.close = ess_1788_close,
.set_params = ess_set_params,
.round_blocksize = ess_round_blocksize,
@@ -211,7 +211,6 @@ const struct audio_hw_if ess_1788_hw_if = {
.allocm = ess_malloc,
.freem = ess_free,
.round_buffersize = ess_round_buffersize,
-   .get_props = ess_1788_get_props,
.trigger_output = ess_audio1_trigger_output,
.trigger_input = ess_audio1_trigger_input,
 };
@@ -230,7 +229,6 @@ const struct audio_hw_if ess_1888_hw_if = {
.allocm = ess_malloc,
.freem = ess_free,
.round_buffersize = ess_round_buffersize,
-   .get_props = ess_1888_get_props,
.trigger_output = ess_audio2_trigger_output,
.trigger_input = ess_audio1_trigger_input,
 };
@@ -982,6 +980,15 @@ essattach(struct ess_softc *sc)
  * Various routines to interface to higher level audio driver
  */
 
+int
+ess_1788_open(void *addr, int flags)
+{
+   if (flags & (FWRITE | FREAD))
+   return ENXIO;
+
+   return ess_open(addr, flags);
+}
+
 int
 ess_open(void *addr, int flags)
 {
@@ -2059,18 +2066,6 @@ ess_round_buffersize(void *addr, int direction, size_t 
size)
return (size);
 }
 
-int
-ess_1788_get_props(void *addr)
-{
-   return (0);
-}
-
-int
-ess_1888_get_props(void *addr)
-{
-   return (AUDIO_PROP_FULLDUPLEX);
-}
-
 /* 
  * Generic functions for ess, not used by audio h/w i/f
  * =
diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
index 45fe009fc61..8be5d5abe74 100644
--- a/sys/dev/isa/gus.c
+++ b/sys/dev/isa/gus.c
@@ -277,7 +277,6 @@ const struct audio_hw_if gus_hw_if = {
.allocm = gus_malloc,
.freem = gus_free,
.round_buffersize = gus_round,
-   .get_props = gus_get_props,
 

Replace audio(9) get_props() with duplex check in open() for record-only drivers

2022-10-27 Thread Klemens Nanni
Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
in their open() if full-duplex mode was requested.

This way, sys/dev/audio.c:audio_open() will fail immediately rather than
later through the to-be-removed get_props() check.

utvfu(4) seems to be the only driver that currently supports recording
but not playing, so I just factored it out into its own diff.

Builds fine.
Feedback? Objection? OK?
---
 sys/dev/usb/utvfu.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sys/dev/usb/utvfu.c b/sys/dev/usb/utvfu.c
index 930f2d12568..dc43144adac 100644
--- a/sys/dev/usb/utvfu.c
+++ b/sys/dev/usb/utvfu.c
@@ -795,7 +795,6 @@ int utvfu_audio_halt_in(void *);
 intutvfu_audio_mixer_set_port(void *, struct mixer_ctrl *);
 intutvfu_audio_mixer_get_port(void *, struct mixer_ctrl *);
 intutvfu_audio_query_devinfo(void *, struct mixer_devinfo *);
-intutvfu_audio_get_props(void *);
 intutvfu_audio_trigger_output(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
 intutvfu_audio_trigger_input(void *, void *, void *, int,
@@ -851,7 +850,6 @@ const struct audio_hw_if utvfu_au_hw_if = {
.set_port = utvfu_audio_mixer_set_port,
.get_port = utvfu_audio_mixer_get_port,
.query_devinfo = utvfu_audio_query_devinfo,
-   .get_props = utvfu_audio_get_props,
.trigger_output = utvfu_audio_trigger_output,
.trigger_input = utvfu_audio_trigger_input,
 };
@@ -1859,6 +1857,9 @@ utvfu_audio_open(void *v, int flags)
if (usbd_is_dying(sc->sc_udev))
return (EIO);
 
+   if ((flags & (FWRITE | FREAD)))
+   return (ENXIO);
+
if ((flags & FWRITE))
return (ENXIO);
 
@@ -1995,12 +1996,6 @@ utvfu_audio_query_devinfo(void *v, struct mixer_devinfo 
*mi)
return (0);
 }
 
-int
-utvfu_audio_get_props(void *v)
-{
-   return (0);
-}
-
 int
 utvfu_audio_trigger_output(void *v, void *start, void *end, int blksize,
 void (*intr)(void *), void *arg, struct audio_params *param)
-- 
2.38.1



bgplgd timeout race

2022-10-27 Thread Claudio Jeker
So the timeout for each request is started when the command is accepted
but the actual fork and exec of bgpctl happens later. So command_pid can
be 0 when the timeout fires. In that case do not kill ourself but instead
just abort this command.

I think this is the proper way to do this dance. Not sure how to really
test this though.
-- 
:wq Claudio

Index: slowcgi.c
===
RCS file: /cvs/src/usr.sbin/bgplgd/slowcgi.c,v
retrieving revision 1.5
diff -u -p -r1.5 slowcgi.c
--- slowcgi.c   27 Oct 2022 13:24:22 -  1.5
+++ slowcgi.c   27 Oct 2022 14:00:52 -
@@ -159,6 +159,7 @@ voidparse_begin_request(uint8_t *, uin
 void   parse_params(uint8_t *, uint16_t, struct request *, uint16_t);
 void   parse_stdin(uint8_t *, uint16_t, struct request *, uint16_t);
 char   *env_get(struct request *, const char *);
+void   error_response(struct request *, int);
 void   exec_cgi(struct request *);
 void   script_std_in(int, short, void *);
 void   script_err_in(int, short, void *);
@@ -505,6 +506,12 @@ slowcgi_timeout(int fd, short events, vo
if (c->script_flags & SCRIPT_DONE)
return;
 
+   if (c->command_pid == 0) {
+   c->command_status = SIGALRM;
+   error_response(c, 408);
+   return;
+   }
+
ldebug("timeout fired for pid %d", c->command_pid);
 
if (c->timeout_fired)
@@ -887,7 +894,7 @@ http_error(int *res)
return "Internal Server Error";
 }
 
-static void
+void
 error_response(struct request *c, int res)
 {
const char *type = "text/html";



bgplgd show pid in more debug messages

2022-10-27 Thread Claudio Jeker
Trying to figure out why bgplgd terminates sometimes.
Since there is a timeout firing at an unexpected time I want some extra
info to figure out what kind of race this is.

-- 
:wq Claudio

Index: slowcgi.c
===
RCS file: /cvs/src/usr.sbin/bgplgd/slowcgi.c,v
retrieving revision 1.4
diff -u -p -r1.4 slowcgi.c
--- slowcgi.c   25 Aug 2022 16:49:18 -  1.4
+++ slowcgi.c   27 Oct 2022 13:01:20 -
@@ -505,7 +505,7 @@ slowcgi_timeout(int fd, short events, vo
if (c->script_flags & SCRIPT_DONE)
return;
 
-   ldebug("timeout fired");
+   ldebug("timeout fired for pid %d", c->command_pid);
 
if (c->timeout_fired)
sig = SIGKILL;
@@ -556,7 +556,7 @@ slowcgi_sig_handler(int sig, short event
else
c->command_status = WEXITSTATUS(status);
 
-   ldebug("exit %s%d",
+   ldebug("pid %d exit %s%d", pid,
WIFSIGNALED(status) ? "signal " : "",
c->command_status);
 



Re: usbdevs(8) getopt tweak

2022-10-27 Thread Todd C . Miller
On Fri, 28 Oct 2022 12:03:15 +1000, David Gwynne wrote:

> usbdevs has "?" in the optstring is passes to getopt, but doesn't handle
> it specially. this is unnecessarily different to everything else in the
> tree, so i want to remove it. ok?

Sure, OK millert@

 - todd



ssh internal refactor

2022-10-27 Thread Damien Miller
Hi,

I just committed a fairly large refactoring of openssh's key handling
code. It *should* be completely invisible, but if you notice any
new problems then please let open...@openssh.com know.

Thanks,
Damien



Re: vmd: remove the user quota tracking

2022-10-27 Thread Matthew Martin
On Wed, Oct 12, 2022 at 09:20:06AM -0400, Dave Voutila wrote:
> 
> 1 week bump for the below. If you use this feature or currently hacking
> on it, speak up by end of week. I'm sharpening my axes.

Are the axes sharp?

> > diff refs/heads/master refs/heads/vmd-user
> > commit - bfe2092d87b190d9f89c4a6f2728a539b7f88233
> > commit + e84ff2c7628a811e00044a447ad906d6e24beac0
> > blob - 374d7de6629e072065b5c0232536c23c1e5bbbe0
> > blob + a192223cf118e2a8764b24f965a15acbf8ae506f
> > --- usr.sbin/vmd/config.c
> > +++ usr.sbin/vmd/config.c
> > @@ -98,12 +98,6 @@ config_init(struct vmd *env)
> > return (-1);
> > TAILQ_INIT(env->vmd_switches);
> > }
> > -   if (what & CONFIG_USERS) {
> > -   if ((env->vmd_users = calloc(1,
> > -   sizeof(*env->vmd_users))) == NULL)
> > -   return (-1);
> > -   TAILQ_INIT(env->vmd_users);
> > -   }
> >
> > return (0);
> >  }
> > @@ -238,13 +232,6 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, ui
> > return (EALREADY);
> > }
> >
> > -   /* increase the user reference counter and check user limits */
> > -   if (vm->vm_user != NULL && user_get(vm->vm_user->usr_id.uid) != NULL) {
> > -   user_inc(vcp, vm->vm_user, 1);
> > -   if (user_checklimit(vm->vm_user, vcp) == -1)
> > -   return (EPERM);
> > -   }
> > -
> > /*
> >  * Rate-limit the VM so that it cannot restart in a loop:
> >  * if the VM restarts after less than VM_START_RATE_SEC seconds,
> > blob - 2f3ac1a76f2c3e458919eca85c238a668c10422a
> > blob + 755cbedb6a18502a87724502ec86e9e426961701
> > --- usr.sbin/vmd/vmd.c
> > +++ usr.sbin/vmd/vmd.c
> > @@ -1188,9 +1188,6 @@ vm_stop(struct vmd_vm *vm, int keeptty, const char *ca
> > vm->vm_state &= ~(VM_STATE_RECEIVED | VM_STATE_RUNNING
> > | VM_STATE_SHUTDOWN);
> >
> > -   user_inc(>vm_params.vmc_params, vm->vm_user, 0);
> > -   user_put(vm->vm_user);
> > -
> > if (vm->vm_iev.ibuf.fd != -1) {
> > event_del(>vm_iev.ev);
> > close(vm->vm_iev.ibuf.fd);
> > @@ -1243,7 +1240,6 @@ vm_remove(struct vmd_vm *vm, const char *caller)
> >
> > TAILQ_REMOVE(env->vmd_vms, vm, vm_entry);
> >
> > -   user_put(vm->vm_user);
> > vm_stop(vm, 0, caller);
> > free(vm);
> >  }
> > @@ -1286,7 +1282,6 @@ vm_register(struct privsep *ps, struct vmop_create_par
> > struct vmd_vm   *vm = NULL, *vm_parent = NULL;
> > struct vm_create_params *vcp = >vmc_params;
> > struct vmop_owner   *vmo = NULL;
> > -   struct vmd_user *usr = NULL;
> > uint32_t nid, rng;
> > unsigned int i, j;
> > struct vmd_switch   *sw;
> > @@ -1362,13 +1357,6 @@ vm_register(struct privsep *ps, struct 
> > vmop_create_par
> > }
> > }
> >
> > -   /* track active users */
> > -   if (uid != 0 && env->vmd_users != NULL &&
> > -   (usr = user_get(uid)) == NULL) {
> > -   log_warnx("could not add user");
> > -   goto fail;
> > -   }
> > -
> > if ((vm = calloc(1, sizeof(*vm))) == NULL)
> > goto fail;
> >
> > @@ -1379,7 +1367,6 @@ vm_register(struct privsep *ps, struct vmop_create_par
> > vm->vm_tty = -1;
> > vm->vm_receive_fd = -1;
> > vm->vm_state &= ~VM_STATE_PAUSED;
> > -   vm->vm_user = usr;
> >
> > for (i = 0; i < VMM_MAX_DISKS_PER_VM; i++)
> > for (j = 0; j < VM_MAX_BASE_PER_DISK; j++)
> > @@ -1903,104 +1890,6 @@ struct vmd_user *
> > return (NULL);
> >  }
> >
> > -struct vmd_user *
> > -user_get(uid_t uid)
> > -{
> > -   struct vmd_user *usr;
> > -
> > -   if (uid == 0)
> > -   return (NULL);
> > -
> > -   /* first try to find an existing user */
> > -   TAILQ_FOREACH(usr, env->vmd_users, usr_entry) {
> > -   if (usr->usr_id.uid == uid)
> > -   goto done;
> > -   }
> > -
> > -   if ((usr = calloc(1, sizeof(*usr))) == NULL) {
> > -   log_warn("could not allocate user");
> > -   return (NULL);
> > -   }
> > -
> > -   usr->usr_id.uid = uid;
> > -   usr->usr_id.gid = -1;
> > -   TAILQ_INSERT_TAIL(env->vmd_users, usr, usr_entry);
> > -
> > - done:
> > -   DPRINTF("%s: uid %d #%d +",
> > -   __func__, usr->usr_id.uid, usr->usr_refcnt + 1);
> > -   usr->usr_refcnt++;
> > -
> > -   return (usr);
> > -}
> > -
> > -void
> > -user_put(struct vmd_user *usr)
> > -{
> > -   if (usr == NULL)
> > -   return;
> > -
> > -   DPRINTF("%s: uid %d #%d -",
> > -   __func__, usr->usr_id.uid, usr->usr_refcnt - 1);
> > -
> > -   if (--usr->usr_refcnt > 0)
> > -   return;
> > -
> > -   TAILQ_REMOVE(env->vmd_users, usr, usr_entry);
> > -   free(usr);
> > -}
> > -
> > -void
> > -user_inc(struct vm_create_params *vcp, struct vmd_user *usr, int inc)
> > -{
> > -   char mem[FMT_SCALED_STRSIZE];
> > -
> > -   if (usr == NULL)
> > -   return;
> > -
> > -   /* increment or decrement counters */
> > -   inc = inc ? 1 : -1;
> > -
> 

usbdevs(8) getopt tweak

2022-10-27 Thread David Gwynne
usbdevs has "?" in the optstring is passes to getopt, but doesn't handle
it specially. this is unnecessarily different to everything else in the
tree, so i want to remove it. ok?

Index: usbdevs.c
===
RCS file: /cvs/src/usr.sbin/usbdevs/usbdevs.c,v
retrieving revision 1.34
diff -u -p -r1.34 usbdevs.c
--- usbdevs.c   12 Jul 2021 15:09:22 -  1.34
+++ usbdevs.c   28 Oct 2022 01:59:52 -
@@ -239,7 +239,7 @@ main(int argc, char **argv)
uint8_t addr = 0;
const char *errstr;
 
-   while ((ch = getopt(argc, argv, "a:d:v?")) != -1) {
+   while ((ch = getopt(argc, argv, "a:d:v")) != -1) {
switch (ch) {
case 'a':
addr = strtonum(optarg, 1, USB_MAX_DEVICES-1, );



Re: usbdevs(8) getopt tweak

2022-10-27 Thread Theo de Raadt
David Gwynne  wrote:

> usbdevs has "?" in the optstring is passes to getopt, but doesn't handle
> it specially. this is unnecessarily different to everything else in the
> tree, so i want to remove it. ok?
> 
> Index: usbdevs.c
> ===
> RCS file: /cvs/src/usr.sbin/usbdevs/usbdevs.c,v
> retrieving revision 1.34
> diff -u -p -r1.34 usbdevs.c
> --- usbdevs.c 12 Jul 2021 15:09:22 -  1.34
> +++ usbdevs.c 28 Oct 2022 01:59:52 -
> @@ -239,7 +239,7 @@ main(int argc, char **argv)
>   uint8_t addr = 0;
>   const char *errstr;
>  
> - while ((ch = getopt(argc, argv, "a:d:v?")) != -1) {
> + while ((ch = getopt(argc, argv, "a:d:v")) != -1) {
>   switch (ch) {
>   case 'a':
>   addr = strtonum(optarg, 1, USB_MAX_DEVICES-1, );
> 

I thought we killed all of those two decades ago.



Re: Replace audio(9) get_props() with duplex check in open() for record-only drivers

2022-10-27 Thread Klemens Nanni
On Thu, Oct 27, 2022 at 03:49:55PM +0200, Alexandre Ratchov wrote:
> On Thu, Oct 27, 2022 at 01:09:57PM +, Klemens Nanni wrote:
> > @@ -1859,6 +1857,9 @@ utvfu_audio_open(void *v, int flags)
> > if (usbd_is_dying(sc->sc_udev))
> > return (EIO);
> >  
> > +   if ((flags & (FWRITE | FREAD)))
> > +   return (ENXIO);
> > +
> > if ((flags & FWRITE))
> > return (ENXIO);
> >  
> 
> We already return ENXIO if playback is requested, so no need for the
> additional full-duplex check

Yes.  My diff was purely mechanical and this single occasion does does
not need an aditional check.

Feedback? OK?

---
 sys/dev/usb/utvfu.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/sys/dev/usb/utvfu.c b/sys/dev/usb/utvfu.c
index 930f2d12568..37b76ffb285 100644
--- a/sys/dev/usb/utvfu.c
+++ b/sys/dev/usb/utvfu.c
@@ -795,7 +795,6 @@ int utvfu_audio_halt_in(void *);
 intutvfu_audio_mixer_set_port(void *, struct mixer_ctrl *);
 intutvfu_audio_mixer_get_port(void *, struct mixer_ctrl *);
 intutvfu_audio_query_devinfo(void *, struct mixer_devinfo *);
-intutvfu_audio_get_props(void *);
 intutvfu_audio_trigger_output(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
 intutvfu_audio_trigger_input(void *, void *, void *, int,
@@ -851,7 +850,6 @@ const struct audio_hw_if utvfu_au_hw_if = {
.set_port = utvfu_audio_mixer_set_port,
.get_port = utvfu_audio_mixer_get_port,
.query_devinfo = utvfu_audio_query_devinfo,
-   .get_props = utvfu_audio_get_props,
.trigger_output = utvfu_audio_trigger_output,
.trigger_input = utvfu_audio_trigger_input,
 };
@@ -1995,12 +1993,6 @@ utvfu_audio_query_devinfo(void *v, struct mixer_devinfo 
*mi)
return (0);
 }
 
-int
-utvfu_audio_get_props(void *v)
-{
-   return (0);
-}
-
 int
 utvfu_audio_trigger_output(void *v, void *start, void *end, int blksize,
 void (*intr)(void *), void *arg, struct audio_params *param)
-- 
2.38.1



[PATCH 3/4] Replace audio(9) get_props() with duplex check in open() for non-duplex drivers

2022-10-27 Thread Klemens Nanni
On Thu, Oct 27, 2022 at 03:51:45PM +0200, Alexandre Ratchov wrote:
> IMO, for play-only drivers, the check should be:
> 
>   if (flags & FREAD)
>   return ENXIO;
> 
> which will reject record-only and full-duplex.

My mistake when typing things down:  those are drivers not supporting
full-duplex mode;  that doesn't mean they don't support recording.

arcofi(4) seems to support recording, just not duplex.

maestro(4)'s BUGS from 2015 says "Recording should work soon", so it is
in fact play-only, but maestro_open() completely ignores the open flags
and always opens the device for playing...

Drivers like maestro(4) should be fixed, but I don't want to mix that
with this purely reject-duplex-mode diff.

Proper message/diff below, sorry for the noise.
Feedback? OK?
---
Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
in their open() if full-duplex mode was requested.

This way, sys/dev/audio.c:audio_open() will fail immediately rather than
later through the to-be-removed get_props() check.

These are all drivers which simply don't support full-duplex mode.

In device-tree based drivers like simpleaudio(4)/rkiis(4) and newer
Apple ones like aplaudio(4)/aplmca(4), this adds a new open() stub to
the low-level drivers which merely does the duplex check.

The rkiis(4) and aplmca(4) stubs don't open anything, but are now
required for simpleaudio(4) and aplaudio(4) to actually do the low-level
driver specific duplex check.

My Pinebook Pro keeps playing audio and recording silence with this diff
just like before (rkiis(4) is currently play-only):
simpleaudio0 at mainbus0
simpleaudio1 at mainbus0
audio0 at simpleaudio1

$ aucat -i song69.wav -o rec.wav

Builds fine on amd64 and arm64.
---
 sys/arch/arm64/dev/aplaudio.c  | 15 ---
 sys/arch/arm64/dev/aplmca.c| 20 
 sys/arch/luna88k/cbus/nec86.c  |  1 -
 sys/arch/luna88k/cbus/nec86hw.c| 10 --
 sys/arch/luna88k/cbus/nec86hwvar.h |  2 --
 sys/dev/fdt/graphaudio.c   | 15 ---
 sys/dev/fdt/rkiis.c| 20 +++-
 sys/dev/fdt/simpleaudio.c  | 15 ---
 sys/dev/ic/arcofi.c| 11 +++
 sys/dev/pci/maestro.c  | 13 +++--
 10 files changed, 33 insertions(+), 89 deletions(-)

diff --git a/sys/arch/arm64/dev/aplaudio.c b/sys/arch/arm64/dev/aplaudio.c
index 2e06448a882..49b0aac2f38 100644
--- a/sys/arch/arm64/dev/aplaudio.c
+++ b/sys/arch/arm64/dev/aplaudio.c
@@ -55,7 +55,6 @@ void  aplaudio_freem(void *, void *, int);
 intaplaudio_set_port(void *, mixer_ctrl_t *);
 intaplaudio_get_port(void *, mixer_ctrl_t *);
 intaplaudio_query_devinfo(void *, mixer_devinfo_t *);
-intaplaudio_get_props(void *);
 intaplaudio_round_blocksize(void *, int);
 size_t aplaudio_round_buffersize(void *, int, size_t);
 intaplaudio_trigger_output(void *, void *, void *, int,
@@ -74,7 +73,6 @@ const struct audio_hw_if aplaudio_hw_if = {
.set_port = aplaudio_set_port,
.get_port = aplaudio_get_port,
.query_devinfo = aplaudio_query_devinfo,
-   .get_props = aplaudio_get_props,
.round_blocksize = aplaudio_round_blocksize,
.round_buffersize = aplaudio_round_buffersize,
.trigger_output = aplaudio_trigger_output,
@@ -401,19 +399,6 @@ aplaudio_query_devinfo(void *cookie, mixer_devinfo_t *dip)
return ENXIO;
 }
 
-int
-aplaudio_get_props(void *cookie)
-{
-   struct aplaudio_softc *sc = cookie;
-   struct dai_device *dai = sc->sc_dai_cpu;
-   const struct audio_hw_if *hwif = dai->dd_hw_if;
-
-   if (hwif->get_props)
-   return hwif->get_props(dai->dd_cookie);
-
-   return 0;
-}
-
 int
 aplaudio_round_blocksize(void *cookie, int block)
 {
diff --git a/sys/arch/arm64/dev/aplmca.c b/sys/arch/arm64/dev/aplmca.c
index 559dd765933..c2bbc4a30a6 100644
--- a/sys/arch/arm64/dev/aplmca.c
+++ b/sys/arch/arm64/dev/aplmca.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -123,11 +124,11 @@ struct aplmca_softc {
 intaplmca_set_format(void *, uint32_t, uint32_t, uint32_t);
 intaplmca_set_sysclk(void *, uint32_t);
 
+intaplmca_open(void *, int);
 intaplmca_set_params(void *, int, int,
struct audio_params *, struct audio_params *);
 void   *aplmca_allocm(void *, int, size_t, int, int);
 void   aplmca_freem(void *, void *, int);
-intaplmca_get_props(void *);
 intaplmca_trigger_output(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
 intaplmca_trigger_input(void *, void *, void *, int,
@@ -136,8 +137,8 @@ int aplmca_halt_output(void *);
 intaplmca_halt_input(void *);
 
 const struct audio_hw_if aplmca_hw_if = {
+   .open = aplmca_open,
.set_params = aplmca_set_params,
-   .get_props = aplmca_get_props,
.allocm = aplmca_allocm,
.freem = 

Re: Replace audio(9) get_props() with duplex check in open() in partial-duplex drivers

2022-10-27 Thread Alexandre Ratchov
On Thu, Oct 27, 2022 at 08:35:31PM +, Klemens Nanni wrote:
> On Thu, Oct 27, 2022 at 03:51:05PM +0200, Alexandre Ratchov wrote:
> > On Thu, Oct 27, 2022 at 01:08:57PM +, Klemens Nanni wrote:
> > > @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
> > >  
> > >   DPRINTF(("ad1848_open: sc=%p\n", sc));
> > >  
> > > + if ((flags & (FWRITE | FREAD)) && sc->mode != 2)
> > > + return ENXIO;
> > > +
> > >   sc->sc_pintr = sc->sc_parg = NULL;
> > >   sc->sc_rintr = sc->sc_rarg = NULL;
> > >  
> > 
> > afaiu, the correct condition for full-duplex check is:
> > 
> > if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
> > ...
> > 
> > (both FWRITE and FREAD set)
> 
> Here's the correct version, sorry for the noise.

no problem! ok ratchov

> ---
>  sys/dev/isa/ad1848.c| 12 
>  sys/dev/isa/ad1848var.h |  2 --
>  sys/dev/isa/ess.c   | 29 -
>  sys/dev/isa/gus.c   | 20 
>  sys/dev/isa/gusvar.h|  2 --
>  sys/dev/isa/pas.c   |  1 -
>  sys/dev/isa/sb.c|  1 -
>  sys/dev/isa/sbdsp.c | 11 ---
>  sys/dev/isa/sbdspvar.h  |  2 --
>  9 files changed, 24 insertions(+), 56 deletions(-)
> 
> diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c
> index bb2b95277a1..26b2cc2ba88 100644
> --- a/sys/dev/isa/ad1848.c
> +++ b/sys/dev/isa/ad1848.c
> @@ -74,6 +74,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
>  
>   DPRINTF(("ad1848_open: sc=%p\n", sc));
>  
> + if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD) && sc->mode != 2)
> + return ENXIO;
> +
>   sc->sc_pintr = sc->sc_parg = NULL;
>   sc->sc_rintr = sc->sc_rarg = NULL;
>  
> @@ -1458,11 +1462,3 @@ ad1848_round(void *addr, int direction, size_t size)
>   size = MAX_ISADMA;
>   return size;
>  }
> -
> -int
> -ad1848_get_props(void *addr)
> -{
> - struct ad1848_softc *sc = addr;
> -
> - return (sc->mode == 2 ? AUDIO_PROP_FULLDUPLEX : 0);
> -}
> diff --git a/sys/dev/isa/ad1848var.h b/sys/dev/isa/ad1848var.h
> index 49c199f64fc..c8af3f04b4b 100644
> --- a/sys/dev/isa/ad1848var.h
> +++ b/sys/dev/isa/ad1848var.h
> @@ -210,6 +210,4 @@ void   *ad1848_malloc(void *, int, size_t, int, int);
>  void ad1848_free(void *, void *, int);
>  size_t   ad1848_round(void *, int, size_t);
>  
> -int  ad1848_get_props(void *);
> -
>  #endif
> diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c
> index 8989dd94b01..eba480013cf 100644
> --- a/sys/dev/isa/ess.c
> +++ b/sys/dev/isa/ess.c
> @@ -74,6 +74,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -115,6 +116,7 @@ struct audio_params ess_audio_default =
>  
>  int  ess_setup_sc(struct ess_softc *, int);
>  
> +int  ess_1788_open(void *, int);
>  int  ess_open(void *, int);
>  void ess_1788_close(void *);
>  void ess_1888_close(void *);
> @@ -148,8 +150,6 @@ size_tess_round_buffersize(void *, int, size_t);
>  
>  
>  int  ess_query_devinfo(void *, mixer_devinfo_t *);
> -int  ess_1788_get_props(void *);
> -int  ess_1888_get_props(void *);
>  
>  void ess_speaker_on(struct ess_softc *);
>  void ess_speaker_off(struct ess_softc *);
> @@ -198,7 +198,7 @@ static const char *essmodel[] = {
>   */
>  
>  const struct audio_hw_if ess_1788_hw_if = {
> - .open = ess_open,
> + .open = ess_1788_open,
>   .close = ess_1788_close,
>   .set_params = ess_set_params,
>   .round_blocksize = ess_round_blocksize,
> @@ -211,7 +211,6 @@ const struct audio_hw_if ess_1788_hw_if = {
>   .allocm = ess_malloc,
>   .freem = ess_free,
>   .round_buffersize = ess_round_buffersize,
> - .get_props = ess_1788_get_props,
>   .trigger_output = ess_audio1_trigger_output,
>   .trigger_input = ess_audio1_trigger_input,
>  };
> @@ -230,7 +229,6 @@ const struct audio_hw_if ess_1888_hw_if = {
>   .allocm = ess_malloc,
>   .freem = ess_free,
>   .round_buffersize = ess_round_buffersize,
> - .get_props = ess_1888_get_props,
>   .trigger_output = ess_audio2_trigger_output,
>   .trigger_input = ess_audio1_trigger_input,
>  };
> @@ -982,6 +980,15 @@ essattach(struct ess_softc *sc)
>   * Various routines to interface to higher level audio driver
>   */
>  
> +int
> +ess_1788_open(void *addr, int flags)
> +{
> + if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
> + return ENXIO;
> +
> + return ess_open(addr, flags);
> +}
> +
>  int
>  ess_open(void *addr, int flags)
>  {
> @@ -2059,18 +2066,6 @@ ess_round_buffersize(void *addr, int direction, size_t 
> size)
>   return (size);
>  }
>  
> -int
> -ess_1788_get_props(void *addr)
> -{
> - return (0);
> -}
> -
> -int
> -ess_1888_get_props(void *addr)
> -{
> - return (AUDIO_PROP_FULLDUPLEX);
> -}
> -
>  /* 
>   * Generic functions for ess, not used by audio h/w i/f
>   * 

Re: Replace audio(9) get_props() with duplex check in open() in partial-duplex drivers

2022-10-27 Thread Klemens Nanni
On Thu, Oct 27, 2022 at 03:51:05PM +0200, Alexandre Ratchov wrote:
> On Thu, Oct 27, 2022 at 01:08:57PM +, Klemens Nanni wrote:
> > @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
> >  
> > DPRINTF(("ad1848_open: sc=%p\n", sc));
> >  
> > +   if ((flags & (FWRITE | FREAD)) && sc->mode != 2)
> > +   return ENXIO;
> > +
> > sc->sc_pintr = sc->sc_parg = NULL;
> > sc->sc_rintr = sc->sc_rarg = NULL;
> >  
> 
> afaiu, the correct condition for full-duplex check is:
> 
>   if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
>   ...
> 
> (both FWRITE and FREAD set)

Here's the correct version, sorry for the noise.

Feedback? OK?
---
 sys/dev/isa/ad1848.c| 12 
 sys/dev/isa/ad1848var.h |  2 --
 sys/dev/isa/ess.c   | 29 -
 sys/dev/isa/gus.c   | 20 
 sys/dev/isa/gusvar.h|  2 --
 sys/dev/isa/pas.c   |  1 -
 sys/dev/isa/sb.c|  1 -
 sys/dev/isa/sbdsp.c | 11 ---
 sys/dev/isa/sbdspvar.h  |  2 --
 9 files changed, 24 insertions(+), 56 deletions(-)

diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c
index bb2b95277a1..26b2cc2ba88 100644
--- a/sys/dev/isa/ad1848.c
+++ b/sys/dev/isa/ad1848.c
@@ -74,6 +74,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
 
DPRINTF(("ad1848_open: sc=%p\n", sc));
 
+   if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD) && sc->mode != 2)
+   return ENXIO;
+
sc->sc_pintr = sc->sc_parg = NULL;
sc->sc_rintr = sc->sc_rarg = NULL;
 
@@ -1458,11 +1462,3 @@ ad1848_round(void *addr, int direction, size_t size)
size = MAX_ISADMA;
return size;
 }
-
-int
-ad1848_get_props(void *addr)
-{
-   struct ad1848_softc *sc = addr;
-
-   return (sc->mode == 2 ? AUDIO_PROP_FULLDUPLEX : 0);
-}
diff --git a/sys/dev/isa/ad1848var.h b/sys/dev/isa/ad1848var.h
index 49c199f64fc..c8af3f04b4b 100644
--- a/sys/dev/isa/ad1848var.h
+++ b/sys/dev/isa/ad1848var.h
@@ -210,6 +210,4 @@ void   *ad1848_malloc(void *, int, size_t, int, int);
 void   ad1848_free(void *, void *, int);
 size_t ad1848_round(void *, int, size_t);
 
-intad1848_get_props(void *);
-
 #endif
diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c
index 8989dd94b01..eba480013cf 100644
--- a/sys/dev/isa/ess.c
+++ b/sys/dev/isa/ess.c
@@ -74,6 +74,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -115,6 +116,7 @@ struct audio_params ess_audio_default =
 
 intess_setup_sc(struct ess_softc *, int);
 
+intess_1788_open(void *, int);
 intess_open(void *, int);
 void   ess_1788_close(void *);
 void   ess_1888_close(void *);
@@ -148,8 +150,6 @@ size_t  ess_round_buffersize(void *, int, size_t);
 
 
 intess_query_devinfo(void *, mixer_devinfo_t *);
-intess_1788_get_props(void *);
-intess_1888_get_props(void *);
 
 void   ess_speaker_on(struct ess_softc *);
 void   ess_speaker_off(struct ess_softc *);
@@ -198,7 +198,7 @@ static const char *essmodel[] = {
  */
 
 const struct audio_hw_if ess_1788_hw_if = {
-   .open = ess_open,
+   .open = ess_1788_open,
.close = ess_1788_close,
.set_params = ess_set_params,
.round_blocksize = ess_round_blocksize,
@@ -211,7 +211,6 @@ const struct audio_hw_if ess_1788_hw_if = {
.allocm = ess_malloc,
.freem = ess_free,
.round_buffersize = ess_round_buffersize,
-   .get_props = ess_1788_get_props,
.trigger_output = ess_audio1_trigger_output,
.trigger_input = ess_audio1_trigger_input,
 };
@@ -230,7 +229,6 @@ const struct audio_hw_if ess_1888_hw_if = {
.allocm = ess_malloc,
.freem = ess_free,
.round_buffersize = ess_round_buffersize,
-   .get_props = ess_1888_get_props,
.trigger_output = ess_audio2_trigger_output,
.trigger_input = ess_audio1_trigger_input,
 };
@@ -982,6 +980,15 @@ essattach(struct ess_softc *sc)
  * Various routines to interface to higher level audio driver
  */
 
+int
+ess_1788_open(void *addr, int flags)
+{
+   if ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
+   return ENXIO;
+
+   return ess_open(addr, flags);
+}
+
 int
 ess_open(void *addr, int flags)
 {
@@ -2059,18 +2066,6 @@ ess_round_buffersize(void *addr, int direction, size_t 
size)
return (size);
 }
 
-int
-ess_1788_get_props(void *addr)
-{
-   return (0);
-}
-
-int
-ess_1888_get_props(void *addr)
-{
-   return (AUDIO_PROP_FULLDUPLEX);
-}
-
 /* 
  * Generic functions for ess, not used by audio h/w i/f
  * =
diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
index 45fe009fc61..6e1d1a00cef 100644
--- a/sys/dev/isa/gus.c
+++ b/sys/dev/isa/gus.c
@@ -277,7 +277,6 @@ const struct audio_hw_if gus_hw_if = {
.allocm = gus_malloc,
.freem = gus_free,

Re: Replace audio(9) get_props() with duplex check in open() for record-only drivers

2022-10-27 Thread Alexandre Ratchov
On Thu, Oct 27, 2022 at 08:28:53PM +, Klemens Nanni wrote:
> On Thu, Oct 27, 2022 at 03:49:55PM +0200, Alexandre Ratchov wrote:
> > On Thu, Oct 27, 2022 at 01:09:57PM +, Klemens Nanni wrote:
> > > @@ -1859,6 +1857,9 @@ utvfu_audio_open(void *v, int flags)
> > >   if (usbd_is_dying(sc->sc_udev))
> > >   return (EIO);
> > >  
> > > + if ((flags & (FWRITE | FREAD)))
> > > + return (ENXIO);
> > > +
> > >   if ((flags & FWRITE))
> > >   return (ENXIO);
> > >  
> > 
> > We already return ENXIO if playback is requested, so no need for the
> > additional full-duplex check
> 
> Yes.  My diff was purely mechanical and this single occasion does does
> not need an aditional check.
> 
> Feedback? OK?
> 

ok ratchov@

> ---
>  sys/dev/usb/utvfu.c | 8 
>  1 file changed, 8 deletions(-)
> 
> diff --git a/sys/dev/usb/utvfu.c b/sys/dev/usb/utvfu.c
> index 930f2d12568..37b76ffb285 100644
> --- a/sys/dev/usb/utvfu.c
> +++ b/sys/dev/usb/utvfu.c
> @@ -795,7 +795,6 @@ int   utvfu_audio_halt_in(void *);
>  int  utvfu_audio_mixer_set_port(void *, struct mixer_ctrl *);
>  int  utvfu_audio_mixer_get_port(void *, struct mixer_ctrl *);
>  int  utvfu_audio_query_devinfo(void *, struct mixer_devinfo *);
> -int  utvfu_audio_get_props(void *);
>  int  utvfu_audio_trigger_output(void *, void *, void *, int,
>   void (*)(void *), void *, struct audio_params *);
>  int  utvfu_audio_trigger_input(void *, void *, void *, int,
> @@ -851,7 +850,6 @@ const struct audio_hw_if utvfu_au_hw_if = {
>   .set_port = utvfu_audio_mixer_set_port,
>   .get_port = utvfu_audio_mixer_get_port,
>   .query_devinfo = utvfu_audio_query_devinfo,
> - .get_props = utvfu_audio_get_props,
>   .trigger_output = utvfu_audio_trigger_output,
>   .trigger_input = utvfu_audio_trigger_input,
>  };
> @@ -1995,12 +1993,6 @@ utvfu_audio_query_devinfo(void *v, struct 
> mixer_devinfo *mi)
>   return (0);
>  }
>  
> -int
> -utvfu_audio_get_props(void *v)
> -{
> - return (0);
> -}
> -
>  int
>  utvfu_audio_trigger_output(void *v, void *start, void *end, int blksize,
>  void (*intr)(void *), void *arg, struct audio_params *param)
> -- 
> 2.38.1
> 
> 



Remove unused audio(9) get_props()/AUDIO_PROP_*

2022-10-27 Thread Klemens Nanni
After converting all drivers to play/record/duplex checks in their
open() handler, those bits are no longer used and can go.

OK once the other diffs are in?
---
 share/man/man9/audio.9 | 5 -
 sys/dev/audio.c| 9 -
 sys/dev/audio_if.h | 7 ---
 3 files changed, 21 deletions(-)

diff --git a/share/man/man9/audio.9 b/share/man/man9/audio.9
index c5e419aaf80..eb266972966 100644
--- a/share/man/man9/audio.9
+++ b/share/man/man9/audio.9
@@ -72,7 +72,6 @@ struct audio_hw_if {
void*(*allocm)(void *, int, size_t, int, int);
void(*freem)(void *, void *, int);
size_t  (*round_buffersize)(void *, int, size_t);
-   int (*get_props)(void *);
 
int (*trigger_output)(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
@@ -344,10 +343,6 @@ Note that the buffer size is always a multiple of the 
block size, so
 and
 .Fn round_buffersize
 must be consistent.
-.It Ft int Fn (*get_props) "void *hdl"
-This function returns a combination of
-.Dv AUDIO_PROP_xxx
-properties.
 .It Ft int Fn (*trigger_output) "void *hdl" "void *start" "void *end" "int 
blksize" \
 "void (*intr)(void *)" "void *intrarg" "struct audio_params *param"
 This function is optional.
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 700a148c042..849bb1bbb67 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1491,15 +1491,6 @@ audio_open(struct audio_softc *sc, int flags)
sc->mode |= AUMODE_PLAY;
if (flags & FREAD)
sc->mode |= AUMODE_RECORD;
-   if (sc->ops->get_props) {
-   int props = sc->ops->get_props(sc->arg);
-   if (sc->mode == (AUMODE_PLAY | AUMODE_RECORD)) {
-   if (!(props & AUDIO_PROP_FULLDUPLEX)) {
-   error = ENOTTY;
-   goto bad;
-   }
-   }
-   }
 
if (sc->ops->speaker_ctl) {
/*
diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h
index 97efa74c75c..ac81e783348 100644
--- a/sys/dev/audio_if.h
+++ b/sys/dev/audio_if.h
@@ -40,11 +40,6 @@
 
 #include 
 
-/*
- * get_props
- */
-#define AUDIO_PROP_FULLDUPLEX  0x01
-
 #define AUDIO_BPS(bits)(bits) <= 8 ? 1 : ((bits) <= 16 ? 2 : 4)
 
 /*
@@ -121,8 +116,6 @@ struct audio_hw_if {
void(*freem)(void *, void *, int);
size_t  (*round_buffersize)(void *, int, size_t);
 
-   int (*get_props)(void *); /* device properties */
-
int (*trigger_output)(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
int (*trigger_input)(void *, void *, void *, int,
-- 
2.38.1



nd6_timer: remove kernel lock

2022-10-27 Thread Klemens Nanni
The kernel lock was added back when there was a single sofnet task queue:

sys/net/nd6.c revision 1.213
date: 2017/08/06 12:53:30;  author: mpi;  state: Exp;  lines: +15 -21;
Reduce contention on the NET_LOCK() by moving the nd6 address expiration
task to the `softnettq`.

While here update comments and names to reflect reality after the 
removal
of router and prefix lists.

ok florian@, bluhm@

I can't find the original thread, but "Reducing NET_LOCK() contention"[0]
and "Reduce NET_LOCK() contention part 2"[1] did similar stuff at that time.
0: https://marc.info/?l=openbsd-tech=150038615913233=2
1: https://marc.info/?l=openbsd-tech=150038690413538=2

Today there are min(4, hw.ncpu) MP-safe softnet task queues as compared to
the single one five years ago:

sys/net/if.c revision 1.652
date: 2022/05/03 11:47:03;  author: bluhm;  state: Exp;  lines: +2 -2;  
Activate parallel IP forwarding.  Start 4 softnet tasks.  Limit the
usage to the number of CPUs.
lots of testing Hrvoje Popovski; OK sashan@ sthen@

Nothing in nd6_expire() or nd6_expire_timer_update() requires protection by
the kernel lock.

Both interface list and per-interface address lists remain protected by
the net lock.

So I suggest putting pressure back onto the net lock.

This has been running fine for me in regular usage on desktop as well as
test machines in IPv6 networks.

Hrvoje was so kind to test this diff without any regressions in his
forward/performance setup, with and without creating extra ND6 traffic to
keep the cache expiry thread busy.

Feedback? Objection? OK?

Index: nd6.c
===
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.248
diff -u -p -r1.248 nd6.c
--- nd6.c   9 Sep 2022 12:05:52 -   1.248
+++ nd6.c   20 Oct 2022 09:54:02 -
@@ -446,8 +446,6 @@ nd6_expire_timer_update(struct in6_ifadd
time_t expire_time = INT64_MAX;
int secs;
 
-   KERNEL_ASSERT_LOCKED();
-
if (ia6->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME)
expire_time = ia6->ia6_lifetime.ia6t_expire;
 
@@ -486,7 +484,6 @@ nd6_expire(void *unused)
 {
struct ifnet *ifp;
 
-   KERNEL_LOCK();
NET_LOCK();
 
TAILQ_FOREACH(ifp, , if_list) {
@@ -509,7 +506,6 @@ nd6_expire(void *unused)
}
 
NET_UNLOCK();
-   KERNEL_UNLOCK();
 }
 
 void



Re: [Patch] add minor clarification to Wireless in faq/faq6.html

2022-10-27 Thread tux2bsd
Stefan Sperling  wrote:
> A better way to improve this page for newcomers 
> would be to add a more examples.

"A better way" stems from a this-or-that mindset.

I like my proposed addition, I would have found it 
useful and it is why I scratched that itch.

I also like your additional examples, you should 
make a patch and add them too.

tux2bsd



[Patch] add minor clarification to Wireless in faq/faq6.html

2022-10-27 Thread tux2bsd
This patch is to add a brief note that 'nwid' & 'join' serve different purposes 
and which man page to consult.



$ git config diff.noprefix
true
$ git diff --relative .
diff --git faq/faq6.html faq/faq6.html
index 08343df0c..52770af6e 100644
--- faq/faq6.html
+++ faq/faq6.html
@@ -398,7 +398,8 @@ inet autoconf
 
 Note that inet autoconf should be after the other configuration
 lines, as the network adapter will not be able to send a DHCP request until
-it is configured.
+it is configured.  The choice between nwid and join
+is explained further in https://man.openbsd.org/ifconfig;>ifconfig(8)
 
 Trunking a Wireless Adapter