Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81409C38142 for ; Tue, 31 Jan 2023 15:03:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 32C951F2; Tue, 31 Jan 2023 16:03:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 32C951F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675177430; bh=+9t83AVA1/2vnd3aPrhZe7f4ysn3M3fVZugIPwlCRtI=; h=Date:From:To:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=qOAFLwV2ZjixjQIBp+5rYXsMTMX4ymtsBeuQHyCzu7/PGCWs/NERlDocGfz+esP75 ezmNdRbsB4xdzXsQ3m3e3ASGLhNXNQPoOeuQ+AQMXj9DiBvldf1LGQiR8AxgDchKDp PlDRnjwOxzG1KUtszyOtgdnkV7d1amYYyqi4IcQ4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DC8C2F80245; Tue, 31 Jan 2023 16:02:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9D22DF804C2; Tue, 31 Jan 2023 16:02:58 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 55D01F80169 for ; Tue, 31 Jan 2023 16:02:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 55D01F80169 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=XD8mWN8v; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=WECNanrz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E41A222724; Tue, 31 Jan 2023 15:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675177368; h=from:from:reply-to: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=x4Qquk4ZWT4KWGaRpHaq8YlKp13UEn8tmipSUg2ndRE=; b=XD8mWN8v+WY9M7n+UcRIQQGhxNCBnJ5863KpANIgk1GeVQmX8qwaHp8wNDPeFOwHMdJiR/ IzPTXX2eIABoIqMCps5q5EqeqP3QxbzLgDlseZBXkfeaTpEKqaJNixbpuKD6pFpqS8YIAJ St+3+d0xphKOtubs353hJLT++UwwQaE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675177368; h=from:from:reply-to: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=x4Qquk4ZWT4KWGaRpHaq8YlKp13UEn8tmipSUg2ndRE=; b=WECNanrzEcwf5dazjgyL1i1oOxipeDcRdKjbBFE290EuPpm12VMwpri4/NqJlvsS8d3tdh 7UQJWWzgjN7xuVCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CC51B13585; Tue, 31 Jan 2023 15:02:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FUw2MZgt2WNIVgAAMHmgww (envelope-from ); Tue, 31 Jan 2023 15:02:48 +0000 Date: Tue, 31 Jan 2023 16:02:48 +0100 Message-ID: <871qnapx0n.wl-tiwai@suse.de> From: Takashi Iwai To: AiO Subject: Re: Bug? Strange crash with snd_hdspm and RME RayDAT on MIDI-input In-Reply-To: <8e1c4dee-7643-807b-737c-276708a3ab8d@aio.nu> References: <8e1c4dee-7643-807b-737c-276708a3ab8d@aio.nu> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, 27 Jan 2023 16:41:42 +0100, AiO wrote: > > Hello there, > > I've tried to find some insights in a weird problem I have with > snd_hdspm. I guess it is an error-report/bug-posting. > > Audio-wise everything is super-duper, so don't worry. However... MIDI > only works outbound from the on-board MIDI interface. > > MIDI-out always works perfectly from the card during normal operations. > > Whenever I connect anything to the MIDI-in and start feeding some > MIDI-data, it seems ALSA crashes on me. here's a more detailed > description: > > * I'm running linux-rt 6.0.5.14.realtime1-3-rt #1 SMP PREEMPT_RT (Arch) > > * When i give it a stream of MIDI data on the MIDI-in while playing > some audio that application (e.g. mplayer or live inputs) logs: > > ALSA: poll time out, polled for 1999005 usecs, Retrying with a > recovery, retry cnt = 1 (2, 3, 4, 5, and so on) > > And ALSA seem stuck in looping the last buffer over and over. > > * Nothing in journal, nothing in dmesg tells anything more about it > > What did I run in to?! :) Possibly it went into the endless loop to flush the MIDI input bytes where the hardware doesn't return the right value (likely returning 0xff constantly). Could you check the patch below? thanks, Takashi -- 8< -- --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1838,7 +1838,9 @@ static inline int snd_hdspm_midi_output_possible (struct hdspm *hdspm, int id) static void snd_hdspm_flush_midi_input(struct hdspm *hdspm, int id) { - while (snd_hdspm_midi_input_available (hdspm, id)) + int count; + + for (count = 0; snd_hdspm_midi_input_available(hdspm, id) && count < 256; count++) snd_hdspm_midi_read_byte (hdspm, id); }