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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 17 Jan 2008 18:24:28 -0800
From:	Harvey Harrison <harvey.harrison@...il.com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Kyle McMartin <kyle@...artin.ca>, akpm@...ux-foundation.org,
	airlied@...ux.ie, linux-kernel@...r.kernel.org
Subject: Re: [mm patch] i915: fix invalid opcode exception on cpus without
	clflush

On Thu, 2008-01-17 at 21:03 -0500, H. Peter Anvin wrote:
> Kyle McMartin wrote:
> > i915_flush_ttm was unconditionally executing a clflush instruction
> > to (obviously) flush the cache. Instead, check if the cpu supports
> > clflush, and if not, fall back to calling wbinvd to flush the entire
> > cache.
> > 
> > Signed-off-by: Kyle McMartin <kmcmartin@...hat.com>
> > 
> > --- a/drivers/char/drm/i915_buffer.c
> > +++ b/drivers/char/drm/i915_buffer.c
> > @@ -286,7 +286,18 @@ void i915_flush_ttm(struct drm_ttm *ttm)
> >  		return;
> >  
> >  	DRM_MEMORYBARRIER();
> > +
> > +#ifdef CONFIG_X86_32
> > +	/* Hopefully nobody has built an x86-64 processor without clflush */
> > +	if (!cpu_has_clflush) {
> > +		wbinvd();
> > +		DRM_MEMORYBARRIER();
> > +		return;
> > +	}
> > +#endif
> > +
> >  	for (i = ttm->num_pages - 1; i >= 0; i--)
> >  		drm_cache_flush_page(drm_ttm_get_page(ttm, i));
> > +
> >  	DRM_MEMORYBARRIER();
> >  }
> 
> The #ifdef is bogus.  If it's required, it should go into 
> asm-x86/required_features.h and then cpu_has_clflush is static; 
> otherwise it's just plain wrong.

I think Andi's CPA patches have some changes regarding wbinvd and
clflush handling, perhaps you can leverage some of his work?

Harvey

--
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