lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 29 May 2009 13:01:15 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Borislav Petkov <borislav.petkov@....com>
Cc:	greg@...ah.com, mingo@...e.hu, norsk5@...oo.com,
	tglx@...utronix.de, hpa@...or.com, mchehab@...hat.com,
	aris@...hat.com, edt@....ca, linux-kernel@...r.kernel.org,
	randy.dunlap@...cle.com
Subject: Re: [PATCH 0/4] amd64_edac: misc fixes

On Fri, 29 May 2009 12:33:29 +0200
Borislav Petkov <borislav.petkov@....com> wrote:

> Hi,
> 
> On Thu, May 28, 2009 at 04:47:20PM -0700, Andrew Morton wrote:
> > On Wed, 20 May 2009 20:43:53 +0200
> > Borislav Petkov <borislav.petkov@....com> wrote:
> > 
> > > here are some minor fixlets which came up lately. I'm sending them
> > > separately as an offset from the rest of the patchset since nothing has
> > > changed there. For details, see
> > > 
> > > git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
> > 
> > My linux-next x86_64 allmodconfig fails to build drivers/edac/amd64_edac.o:
> > 
> > {standard input}: Assembler messages:
> > {standard input}:3026: Error: no such instruction: `popcnt %eax,%ecx'
> 
> I guess this is a rather old(er) toolchain you got there. What do
> 
> as --version
> gcc --version
> 
> say?

gcc-4.0.2, gas-2.16.1

Here's your sent-off-list patch (please don't do that):

diff -puN drivers/edac/amd64_edac.c~edac-build-fix drivers/edac/amd64_edac.c
--- a/drivers/edac/amd64_edac.c~edac-build-fix
+++ a/drivers/edac/amd64_edac.c
@@ -1419,7 +1419,7 @@ static u32 f10_determine_channel(struct 
 		if (dct_sel_interleave_addr(pvt) == 0)
 			cs = sys_addr >> 6 & 1;
 		else if ((dct_sel_interleave_addr(pvt) >> 1) & 1) {
-			temp = popcnt((u32) ((sys_addr >> 16) & 0x1F)) % 2;
+			temp = hweight_long((u32) ((sys_addr >> 16) & 0x1F)) % 2;
 
 			if (dct_sel_interleave_addr(pvt) & 1)
 				cs = (sys_addr >> 9 & 1) ^ temp;
diff -puN drivers/edac/amd64_edac.h~edac-build-fix drivers/edac/amd64_edac.h
--- a/drivers/edac/amd64_edac.h~edac-build-fix
+++ a/drivers/edac/amd64_edac.h
@@ -443,19 +443,6 @@ enum {
 #define K8_MSR_MC4STAT			0x0411
 #define K8_MSR_MC4ADDR			0x0412
 
-/*
- * popcnt - count the set bits in a bit vector.
- * @vec - bit vector
- *
- * This instruction is supported only on F10h and later CPUs.
- */
-#define popcnt(x)						\
-({								\
-	typeof(x) __ret;					\
-	__asm__("popcnt %1, %0" : "=r" (__ret) : "r" (x));	\
-	__ret;							\
-})
-
 /* AMD sets the first MC device at device ID 0x18. */
 static inline int get_mc_node_id_from_pdev(struct pci_dev *pdev)
 {
_

That'll work.

A suitable way to solve all this would be to arrange for x86's hweight()
to use the popcnt instruction, where that makes sense.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ