From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Sleep and Wake up
Date: Tue, 3 May 2011 14:10:10 +0700 [thread overview]
Message-ID: <BANLkTimZfzOZe2TFrk2qScn6wABL3HbYwA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimpAEycOnqO1qErguf0zbuLd8yB8g@mail.gmail.com>
Hi Abu...
On Tue, May 3, 2011 at 01:32, Abu Rasheda <rcpilot2010@gmail.com> wrote:
> I am testing my driver on much faster host processor and facing
> following issues:
>
> My host is too powerful and it can fill up device buffer queue very fast.
>
> I get best performance when I do busy wait, but this is not desirable
> and is bad design.
For me, busy waiting could be the best for your case... in fact, NAPI
sometimes do that too....in most cases.
Actually, devices usually fills the in-RAM buffer with the help of
interrupt(s). So whenever in-device buffer has something new, it
interrupts...then soft irq follows up by copying them to RAM buffe
(circular buffer usually). To make it fast, DMA or other CPU less
operation kicks in here.
So I think that;s the key...by relying on the interrupts...then you
will know when your buffer is about to be full.
Other than that, I would still say, busy waiting could be your best bet.
PS: here's crazy idea, if you can accept it. Put a guard page, right
at the tail of your buffer,. Make it unwritable even by kernel mode.
Right when you hit it, page fault should kicks in. Then you know
buffer is full. This is inspired by the stack guard..usual method in
user space to reduce buffer overflow risk.
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
next prev parent reply other threads:[~2011-05-03 7:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 18:32 Sleep and Wake up Abu Rasheda
2011-05-02 19:28 ` Greg KH
2011-05-02 21:02 ` Abu Rasheda
2011-05-02 22:04 ` Greg KH
2011-05-02 23:04 ` Fwd: " Abu Rasheda
2011-05-02 19:40 ` Kernel compilation Ezequiel García
2011-05-05 14:15 ` Pico Geyer
2011-05-03 7:10 ` Mulyadi Santosa [this message]
2011-05-10 3:14 ` Sleep and Wake up Peter Teoh
-- strict thread matches above, loose matches on Subject: below --
2011-05-03 2:13 Vikram Narayanan
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=BANLkTimZfzOZe2TFrk2qScn6wABL3HbYwA@mail.gmail.com \
--to=mulyadi.santosa@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/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).