From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 11 13:43:14 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 24ECC16A41B for ; Sun, 11 Jun 2006 13:43:14 +0000 (UTC) (envelope-from root@hnaz.ath.cx) Received: from 4profs.de (4profs.de [62.216.169.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id B028743D45 for ; Sun, 11 Jun 2006 13:43:13 +0000 (GMT) (envelope-from root@hnaz.ath.cx) Received: from localhost (localhost [127.0.0.1]) by 4profs.de (Postfix) with ESMTP id 309DC8BC42 for ; Sun, 11 Jun 2006 15:43:08 +0200 (CEST) Received: from 4profs.de ([127.0.0.1]) by localhost (exilia [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 19893-08 for ; Sun, 11 Jun 2006 15:43:07 +0200 (CEST) Received: from localhost (ppp406.jetzweb.de [217.65.21.150]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by 4profs.de (Postfix) with ESMTP id AC94F8BC41 for ; Sun, 11 Jun 2006 15:43:06 +0200 (CEST) Date: Sun, 11 Jun 2006 15:44:19 +0200 From: Johannes Weiner To: freebsd-hackers@freebsd.org Message-ID: <20060611134419.GA71676@leiferikson.flosken.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: mutt-ng/devel-r804 (FreeLSD) X-Virus-Scanned: by amavisd-new at 4profs.de X-Mailman-Approved-At: Sun, 11 Jun 2006 14:12:42 +0000 Subject: Kernelinternal function return value caching? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jun 2006 13:43:14 -0000 Hi folks, when I found out, that playing sound with xmms does not always work out 100%, I started experimenting with the sound driver. What I got first was, that when a sound channel is opened/initialized, the optimal playback values for speed, format and blocksize of the channel are guessed by iterating combinations until the best is found (at least that is what I think it does). When this is done, the playback is started. Not all playback parameters are increased simultaneously, though. The blocksize incrementation doesn't work out. Although the function for setting it to a higher value is called, it just doesn't get executed. I checked that with a simple printf() within the concerned function. I read how objects are looked up and saw that KOBJOPLOOKUP() tries to cache functions before looking them up again. This should not lead to the caching of function return values instead of really executing them, should it? I wrote a small frontend to avoid KOBJOPLOOKUP() and even after I got a straight pointer on the function, and make a call on this, it still doesn't get executed. How could that be? Is it possible that the return values are cached when a function is inlined or marked static? I don't get it... Hannes PS: code reference: * hardware-specific setblocksize() that doesn't get executed when called: static int fm801ch_setblocksize() in sys/dev/sound/pci/fm801.c * generic setblocksize() that should execute the specific one: int chn_setblocksize() in sys/dev/sound/pcm/channel.c calls specific setblocksize() with the macro CHANNEL_SETBLOCKSIZE()