Thomas Hellstrom wrote: > Hi! > > One problem with this patch is that it conflicts with the way graphics > drivers traditionally handles > the situation, namely > > 1) Set up mtrr > 2) Map. If fallback to uncached minus we will still have write-combined > access. > > I think mtrr-add used in this fashion will typically fail due to the > alignment constraints. In particular, > for set_memory_wc() the typical usage pattern is a large number of pages > in a fragmented physical address space. Yes, maybe this patch tries to change current behavior too less. Indeed, if setting up MTRR entries it simply behaves as today, and userspace does not see that write combining is not correctly enabled. > So if we were to fix the problem with libpciaccess in the kernel, I > think the best option would be to fail the user-space mapping when we > can't make it write-combined. One idea to do this would be the attached patch. It simply returns an error if PAT is not available. It does not even try to use MTRR on its own. But maybe even better would be to combine both patches to something like this: 1. try to use PAT 2. if this fails try to set up MTRR 3. if this also fails, return error Kind regards, Thomas