From: Junjie Cao <junjie.cao@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
John Keeping <jkeeping@inmusicbrands.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Ruslan <ruslan.panasiuk@gmail.com>
Subject: Re: [PATCH] ALSA: seq: midi: wait for output buffer space on non-atomic delivery
Date: Tue, 1 Sep 2026 22:38:03 +0800 [thread overview]
Message-ID: <20260901143803.422827-1-junjie.cao@intel.com> (raw)
In-Reply-To: <871pbddz5k.wl-tiwai@suse.de>
On Tue, 01 Sep 2026 12:49:43 +0200, Takashi Iwai wrote:
> But, the problem is that you can't take long time in
> dump_midi() which is called from the sequencer event handler, per
> design; the atomic=false there doesn't mean that you are allowed to
> block for a too long time like 30 seconds.
Right, dropping this one.
> For working around this problem, we need a basic design change in ALSA
> sequencer core, I'm afraid.
Would you take an RFC along these lines, or do you have a different
shape in mind?
- event_input gets a way to say "port full": the core parks the event
on a per-port FIFO instead of dropping it, copying direct/USRPTR
payloads into the sender's pool cells (snd_seq_event_dup(),
non-blocking). While the FIFO is non-empty, further events for
that port queue behind it.
- The kernel client signals readiness through a new snd_seq_kernel_*
call and a work item re-offers the parked cells. seq_midi would
drive that from rawmidi's transmit ack, mirroring the input-side
runtime->event hook.
- Backpressure stays at the sender's pool, the only place that sleeps
today: a blocking writer with parked cells waits for pool space
before its next direct dispatch, with ioctl_mutex dropped as
snd_seq_cell_alloc() does; poll() already reports pool room.
Nothing sleeps inside delivery.
- Client exit purges its parked cells from every port, as
snd_seq_queue_client_leave() does for queues; port deletion frees
the FIFO.
Open points: a SysEx bigger than the rawmidi buffer is consumed
partially, so the resume offset has to live in the parked entry or in
the driver; one event larger than the sender's pool cannot be parked
at all (the limit queued events already have); a broadcast is
duplicated per blocked destination. Drivers that never report "full"
keep the current behaviour.
next prev parent reply other threads:[~2026-09-01 14:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 14:32 [PATCH] ALSA: seq: midi: wait for output buffer space on non-atomic delivery Junjie Cao
2026-09-01 10:49 ` Takashi Iwai
2026-09-01 14:38 ` Junjie Cao [this message]
2026-09-02 13:59 ` Takashi Iwai
2026-09-13 11:48 ` Junjie Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901143803.422827-1-junjie.cao@intel.com \
--to=junjie.cao@intel.com \
--cc=jkeeping@inmusicbrands.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=ruslan.panasiuk@gmail.com \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.