Skip to content

Commit

Permalink
x86: cpa_flush_array wbinvd should be done on all CPUs
Browse files Browse the repository at this point in the history
cpa_flush_array seems to prefer wbinvd() over clflush at 4M threshold.
clflush needs to be done on only one CPU as per instruction definition.
wbinvd() however, should be done on all CPUs.

[ Impact: fix missing flush which could cause data corruption ]

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
venkatesh.pallipadi@intel.com authored and H. Peter Anvin committed May 22, 2009
1 parent 0b82753 commit 0af48f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
}
}

static void wbinvd_local(void *unused)
{
wbinvd();
}

static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
Expand All @@ -219,7 +224,8 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
/* 4M threshold */
if (numpages >= 1024) {
if (boot_cpu_data.x86 >= 4)
wbinvd();
on_each_cpu(wbinvd_local, NULL, 1);

return;
}
/*
Expand Down

0 comments on commit 0af48f4

Please sign in to comment.