From: Vinod Koul <vinod.koul@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"broonie@opensource.wolfsonmicro.com"
<broonie@opensource.wolfsonmicro.com>, "lrg@ti.com" <lrg@ti.com>,
"Nallasellan, Singaravelan" <singaravelan.nallasellan@intel.com>
Subject: Re: [PATCH v4 4/6] core: add API header and driver header files
Date: Tue, 13 Dec 2011 19:54:27 +0530 [thread overview]
Message-ID: <1323786267.1641.93.camel@vkoul-udesk3> (raw)
In-Reply-To: <s5hehw8pnz4.wl%tiwai@suse.de>
On Tue, 2011-12-13 at 15:04 +0100, Takashi Iwai wrote:
> At Tue, 13 Dec 2011 19:21:30 +0530,
> Nallasellan, Singaravelan wrote:
> >
> > > > > + size_t buffer_size;
> > > > > + size_t fragment_size;
> > > > Can we define buffer_size and fragment_size as unsigned items?
> > >
> > > size_t is unsigned.
> > >
> > > But, it needs consideration whether size_t is the best choice, since size_t is basically
> > > a long, thus its size is different between 32bit and 64bit architectures. This may lead
> > > to mess in many cases when you think of overlapping.
> > >
> > Sorry for my mess on size_t.
> > I think the assumption here is 32 bits. Should u32 be fine here?
>
> This depends pretty much on the demand and the implementation.
> Unless a buffer over 4GB is needed, u32 should be OK for buffer_size,
> etc. (Or, in this case, unsigned int would be fine, too. It's not
> necessarily be limited to 32bit. u32 or such is used usually for the
> type that must be 32bit.)
I don't think someone would need buffer of 4GB :)
> But, the questions remain for hw_pointer, app_pointer, bytes_*
> fields. Are these supposed to be 32bit or more? This question is
> more important than the buffer size. The buffer size would be rarely
> over 32bit. But, if hw_pointer or such represents the accumulated
> position like ALSA PCM does, you'll face the overlapping problem.
> 32bit limit can be reached easily in the real use case.
the pointer are offsets within the ring buffer.
there are cumulative counters which will get overlapped after the
size_t/u32 value.
>
> When this changes between 32bit and 64bit, think twice about the 32bit
> compat-layer on 64bit arch (and the corresponding user-space
> implementation)...
Is it a fair assumption that userspace compiled for 32 bit should work
with 32 bit kernel and same for 64 bit, or does the ABI mandate it be
consistent across 32 and 64 bits. In the latter case we should change
the ones in kernel ABI to consistent size of u32/u64. IMO u32 should be
fine, please let me know if anyone thinks otherwise.
In former size_t should be fine :)
--
~Vinod
next prev parent reply other threads:[~2011-12-13 14:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 12:49 [PATCH v4 4/6] core: add API header and driver header files Nallasellan, Singaravelan
2011-12-13 12:51 ` Mark Brown
2011-12-13 13:02 ` Nallasellan, Singaravelan
2011-12-13 13:23 ` Takashi Iwai
2011-12-13 13:51 ` Nallasellan, Singaravelan
2011-12-13 14:04 ` Takashi Iwai
2011-12-13 14:24 ` Vinod Koul [this message]
2011-12-13 15:01 ` Takashi Iwai
2011-12-13 17:46 ` Vinod Koul
-- strict thread matches above, loose matches on Subject: below --
2011-12-05 7:39 [PATCH v3 0/6] core: add compress data API to ALSA kernel Vinod Koul
2011-12-13 9:02 ` [PATCH v4 4/6] core: add API header and driver header files Vinod Koul
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=1323786267.1641.93.camel@vkoul-udesk3 \
--to=vinod.koul@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@ti.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=singaravelan.nallasellan@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).