All of lore.kernel.org
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Laurent Desnogues <laurent.desnogues@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Mulyadi Santosa <mulyadi.santosa@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] tcg: Remove stack protection from helper functions
Date: Mon, 26 Sep 2011 18:20:15 +0000	[thread overview]
Message-ID: <CAAu8pHvLNhc+weYBH5Bc3SK9Nwsu1QXYLrmvMZM=stNaD-N5_A@mail.gmail.com> (raw)
In-Reply-To: <4E80B768.8010000@siemens.com>

On Mon, Sep 26, 2011 at 5:33 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> On 2011-09-26 19:22, Blue Swirl wrote:
>> On Mon, Sep 26, 2011 at 11:56 AM, Peter Maydell
>> <peter.maydell@linaro.org> wrote:
>>> On 26 September 2011 12:43, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>>> On 2011-09-26 13:33, Peter Maydell wrote:
>>>>> On 26 September 2011 11:51, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>>>>> This increases the overhead of frequently executed helpers. We need to
>>>>>> move rule past QEMU_CFLAGS assignment to ensure that the required simple
>>>>>> assignment picks up all bits. The signal workaround is moved just for
>>>>>> the sake of consistency.
>>>>>
>>>>>> +# NOTE: Must be after the last QEMU_CFLAGS assignment
>>>>>> +op_helper.o user-exec.o: QEMU_CFLAGS := $(subst -fstack-protector-all,,$(QEMU_CFLAGS)) $(HELPER_CFLAGS)
>>>>>
>>>>> Why also user-exec.o ?
>>>>
>>>> That's a good question. It doesn't look like it's deserving this.
>>>>
>>>>> Why not the other source files with helpers in?
>>>>
>>>> Name them and I add them.
>>>
>>> target-*/*helper.c ?
>>>
>>> But mostly I think what I'm trying to say is that this is making
>>> a tradeoff between safety and speed, so it ought to come with a
>>> rationale for why it is OK to remove the safety checks for these
>>> files. Given that rationale you can identify other files that are
>>> also safe/worthwhile to flip the flag for.
>>
>> I wouldn't remove -fstack-protector-all by default. Especially op code
>> interfaces with the guest.
>
> I'd love to have some function attribute for this, because a stack
> protector for rather simple arithmetic operations or something like
> helper_cli/sti are pointlessly burned cycles.

In order to avoid burning the cycles, there is a certain kernel module
which gives almost native performance.

> Maybe we can introduce op_helper_simple.c.
>
>>
>> For max performance version, I'd check if -fomit-frame-pointer and -O3
>> makes sense. See also this article:
>> https://www.debian-administration.org/article/672/Optimizing_code_via_compiler_flags
>
> We already run without frame pointers, -O3 might be worth exploring in
> addition. Still, that won't take the protector overhead away.

It would be interesting to have some benchmarks. I'd expect that most
of the run time is spent within generated code, the next largest item
should be the translator and any helpers should be marginal.

  reply	other threads:[~2011-09-26 18:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26  7:46 [Qemu-devel] [PATCH] tcg: Remove stack protection from helper functions Jan Kiszka
2011-09-26  8:01 ` Mulyadi Santosa
2011-09-26  8:15   ` Laurent Desnogues
2011-09-26 17:41     ` Avi Kivity
2011-09-26 19:43       ` Richard Henderson
2011-09-26 19:52         ` Avi Kivity
2011-09-26 19:53           ` Richard Henderson
2011-09-26 20:20             ` Avi Kivity
2011-09-26 20:19           ` Peter Maydell
2011-09-26 20:26             ` Avi Kivity
2011-09-27  4:29             ` Andi Kleen
2011-09-27  7:58               ` Peter Maydell
2011-09-26 10:51 ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2011-09-26 11:33   ` Peter Maydell
2011-09-26 11:43     ` Jan Kiszka
2011-09-26 11:56       ` Peter Maydell
2011-09-26 17:22         ` Blue Swirl
2011-09-26 17:33           ` Jan Kiszka
2011-09-26 18:20             ` Blue Swirl [this message]
2011-09-26 18:25               ` Jan Kiszka
2011-09-26 18:40                 ` Blue Swirl
2011-09-26 19:08               ` Peter Maydell

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='CAAu8pHvLNhc+weYBH5Bc3SK9Nwsu1QXYLrmvMZM=stNaD-N5_A@mail.gmail.com' \
    --to=blauwirbel@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=laurent.desnogues@gmail.com \
    --cc=mulyadi.santosa@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.