From: Roland Dreier <rdreier@cisco.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Om <om.turyx@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: 64 bit PCI access using MMX register -- how?
Date: Wed, 07 Jan 2009 22:46:45 -0800 [thread overview]
Message-ID: <adahc4as3ai.fsf@cisco.com> (raw)
In-Reply-To: <8763kqxs2p.fsf@basil.nowhere.org> (Andi Kleen's message of "Thu, 08 Jan 2009 06:52:30 +0100")
> I think he was ok because he saved the MMX state by itself, except:
>
> - There was no guarantee that the FPU is in MMX state, not x87 state
> - He'll often get a lazy fpu save exception. This used to BUG()
> in some cases when invoked from kernel space (but that might have been
> changed now). Better is to disable this explicitely around
> the access (like in kernel_fpu_begin()/end())
> - Doing this all properly is fairly expensive and I suspect
> just using a lock will be cheaper.
I had some code a long time ago that used SSE (I think movlps was the
opcode I chose) to get an atomic 64-bit PIO operation. To do that, I
just needed to disable preemption and save/restore cr0 around the SSE
operation, and just save/restore the single xmm register I used. Of
course it only works on CPUs that have SSE. That avoids the nastiness
of x87/mmx state, but in the end a spinlock around two readl()s was
faster and a ton simpler, so I threw all that code away.
- R.
prev parent reply other threads:[~2009-01-08 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 23:03 64 bit PCI access using MMX register -- how? Om
2009-01-07 23:39 ` Alan Cox
2009-01-08 5:52 ` Andi Kleen
2009-01-08 6:46 ` Roland Dreier [this message]
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=adahc4as3ai.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=om.turyx@gmail.com \
/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