NetBSD Problem Report #52586

From www@NetBSD.org  Sun Oct  1 04:33:59 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C0C947A17B
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  1 Oct 2017 04:33:59 +0000 (UTC)
Message-Id: <20171001043358.B6F9B7A1F9@mollari.NetBSD.org>
Date: Sun,  1 Oct 2017 04:33:58 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: auconv: LINEARN_LINEAR macro is mostly broken
X-Send-Pr-Version: www-1.0

>Number:         52586
>Category:       kern
>Synopsis:       auconv: LINEARN_LINEAR macro is mostly broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    isaki
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 01 04:35:00 +0000 2017
>Closed-Date:    Sat May 25 03:14:34 +0000 2019
>Last-Modified:  Sat May 25 03:14:34 +0000 2019
>Originator:     Tetsuya Isaki
>Release:        NetBSD 8.99.3
>Organization:
>Environment:
NetBSD 8.99.3 x68k
>Description:
Linear-to-linear converter generated from LINEARN_LINEAR macro in
auconv.c 1.27 is mostly broken.

I tested all 320 pattern which the macro attempts to support.  i.e.,
5 input prec/valid pairs * 4 output precisions *
2 input (signed/unsigned) * 2 input endianness *
2 output (signed/unsigned) * 2 output endianness.
And it failed on 264 cases (includes 10 infinate loop !).

 full result: http://www.netbsd.org/~isaki/20170930-auconv-result.txt
 adhoc test: http://www.netbsd.org/~isaki/20170930-auconv-test.diff

First point.  It's necessary to provide a parmanent test like atf.
Although I don't know how to do it...

Second point.  Is there a need to provide such a full cross conversion
(occupying kernel text segments)?
At least 24-to-24 will never be used because MI's mixring does not use
24bit precision at present, and unsigned-to-unsigned will also never
be used because MI's mixring only supports SLINEAR.

>How-To-Repeat:
Run "audioplay ulinear8.wav" on x68k (or on a big endian platform
where audio(4) uses slinear16 as virtual channel).

In this case, linear8_8_to_linear16() converter is used.
linear8_8_to_linear16(src=ULINEAR_LE, dst=SLINEAR_BE) should convert
0x01 into 0x8100 (0x81 0x00 on memory on BE) but it got 0x0081.
So it plays very small sound.

>Fix:
It is better to clarify the specification first.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Sun, 01 Oct 2017 22:22:01 +0000
Responsible-Changed-Why:
Take.


From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52586 CVS commit: src/sys/dev
Date: Mon, 2 Oct 2017 06:06:43 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Mon Oct  2 06:06:43 UTC 2017

 Modified Files:
 	src/sys/dev: auconv.c

 Log Message:
 Improve LINEAR_LINEARN macro - inparticular BE/LE conversions.

 Addresses part of PR kern/52586 analyzed and reported by isaki@.


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 src/sys/dev/auconv.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52586 CVS commit: src/sys/dev
Date: Mon, 2 Oct 2017 07:06:15 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Mon Oct  2 07:06:15 UTC 2017

 Modified Files:
 	src/sys/dev: auconv.c

 Log Message:
 Allow maxused to be an odd number of bytes.  This makes single byte
 conversions work for the test described in the PR.

 Addresses another part of PR kern/52586.


 To generate a diff of this commit:
 cvs rdiff -u -r1.32 -r1.33 src/sys/dev/auconv.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52586 CVS commit: src/sys/dev
Date: Sat, 16 Dec 2017 16:09:36 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Sat Dec 16 16:09:36 UTC 2017

 Modified Files:
 	src/sys/dev: auconv.c auconv.h

 Log Message:
 Replace LINEARN_TO_LINEARN macro with individual optimized functions for
 8, 16, 24 and 32 bits linear to linear conversions.

 Addresses PR kern/52586.


 To generate a diff of this commit:
 cvs rdiff -u -r1.34 -r1.35 src/sys/dev/auconv.c
 cvs rdiff -u -r1.20 -r1.21 src/sys/dev/auconv.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52586 CVS commit: [netbsd-8] src/sys/dev
Date: Tue, 9 Jan 2018 19:35:03 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Tue Jan  9 19:35:03 UTC 2018

 Modified Files:
 	src/sys/dev [netbsd-8]: auconv.c auconv.h mulaw.c mulaw.h

 Log Message:
 Pull up following revision(s) (requested by nat in ticket #485):
 	sys/dev/auconv.c: 1.32-1.35
 	sys/dev/auconv.h: 1.20-1.21
 	sys/dev/mulaw.c: 1.33
 	sys/dev/mulaw.h: 1.25
 Improve LINEAR_LINEARN macro - inparticular BE/LE conversions.
 Addresses part of PR kern/52586 analyzed and reported by isaki@.
 --
 Allow maxused to be an odd number of bytes.  This makes single byte
 conversions work for the test described in the PR.
 Addresses another part of PR kern/52586.
 --
 Remove 24 bit in a 32 bit container filters.
 At present this filter did not work well and has caused problems with
 the audio mixer disabled for hdaudio(4).
 These filters may return when they are fixed.
 --
 Replace LINEARN_TO_LINEARN macro with individual optimized functions for
 8, 16, 24 and 32 bits linear to linear conversions.
 Addresses PR kern/52586.
 --
 mulaw/alaw_to_linearN macros replaced with individual faster filters.
 NFC.


 To generate a diff of this commit:
 cvs rdiff -u -r1.26.2.3 -r1.26.2.4 src/sys/dev/auconv.c
 cvs rdiff -u -r1.16.42.2 -r1.16.42.3 src/sys/dev/auconv.h
 cvs rdiff -u -r1.28.42.2 -r1.28.42.3 src/sys/dev/mulaw.c
 cvs rdiff -u -r1.20.80.1 -r1.20.80.2 src/sys/dev/mulaw.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: nat->kern-bug-people
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Wed, 08 May 2019 21:54:09 +0000
Responsible-Changed-Why:


Responsible-Changed-From-To: kern-bug-people->isaki
Responsible-Changed-By: isaki@NetBSD.org
Responsible-Changed-When: Sat, 25 May 2019 03:14:34 +0000
Responsible-Changed-Why:


State-Changed-From-To: open->closed
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Sat, 25 May 2019 03:14:34 +0000
State-Changed-Why:
By merging isaki-audio2 branch, the macro was gone.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.