linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"Borislav Petkov" <bp@suse.de>, "H . Peter Anvin" <hpa@zytor.com>,
	"Andy Lutomirski" <luto@amacapital.net>,
	"Brian Gerst" <brgerst@gmail.com>,
	"Denys Vlasenko" <dvlasenk@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@kernel.org>, "Jiri Kosina" <jkosina@suse.cz>
Subject: Re: [PATCH] x86/hweight: Don't clobber %rdi
Date: Mon, 8 Aug 2016 20:55:09 +0200	[thread overview]
Message-ID: <20160808185509.GG511@nazgul.tnic> (raw)
In-Reply-To: <CA+55aFzC7O16BASN08yKr2XBaBnQbsWWMhweUk_ErB-Mm9Jm=A@mail.gmail.com>

On Mon, Aug 08, 2016 at 11:45:58AM -0700, Linus Torvalds wrote:
> That would work (although the clobbered registers have a different
> syntax than the in/out registers), but it would be wrong, in my
> opinion.
> 
> We want the actual POPCNT instruction to be the common case, and that
> instruction does *not* clobber any other registers than the output.

Ok, that's a good point. We would be punishing the common case.

> So I think it's much better to just say: "the __sw_hweight functions
> should have the same semantics as popcnt" (although without the eflags
> rules that we don't care about).
> 
> There's nothing wrong with keeping it as assembly language - it's not
> like it's a maintenance headache once it is written.

Yap, makes a whole lotta sense to me.

Thanks!

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

      reply	other threads:[~2016-08-08 18:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 17:35 [PATCH] x86/hweight: Don't clobber %rdi ville.syrjala
2016-08-08 17:58 ` Linus Torvalds
2016-08-08 18:32   ` Peter Zijlstra
2016-08-08 18:53     ` Jiri Kosina
2016-08-08 19:17       ` Borislav Petkov
2016-08-08 18:04 ` Borislav Petkov
2016-08-08 18:21   ` Linus Torvalds
2016-08-08 18:37     ` Borislav Petkov
2016-08-08 18:45       ` Linus Torvalds
2016-08-08 18:55         ` Borislav Petkov [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=20160808185509.GG511@nazgul.tnic \
    --to=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=ville.syrjala@linux.intel.com \
    --cc=x86@kernel.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).