lkml.org 
[lkml]   [2018]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 02/12] iommu/vt-d: Manage scalalble mode PASID tables
On Thu, 6 Sep 2018 10:46:03 +0800
Lu Baolu <baolu.lu@linux.intel.com> wrote:

> >> @@ -224,7 +271,14 @@ struct pasid_entry
> >> *intel_pasid_get_entry(struct device *dev, int pasid)
> >> */
> >> static inline void pasid_clear_entry(struct pasid_entry *pe)
> >> {
> >> - WRITE_ONCE(pe->val, 0);
> >> + WRITE_ONCE(pe->val[0], 0);
> >> + WRITE_ONCE(pe->val[1], 0);
> >> + WRITE_ONCE(pe->val[2], 0);
> >> + WRITE_ONCE(pe->val[3], 0);
> >> + WRITE_ONCE(pe->val[4], 0);
> >> + WRITE_ONCE(pe->val[5], 0);
> >> + WRITE_ONCE(pe->val[6], 0);
> >> + WRITE_ONCE(pe->val[7], 0);
> >
> > memset?
>
> The order is important here. Otherwise, the PRESENT bit of this pasid
> entry might still set while other fields contains invalid values.

WRITE_ONCE/READ_ONCE will switch to __builtin_memcpy() in if the size
exceeds word size, ie. 64bit in this case. I don;t think compiler will
reorder built-in function. Beside, we only need to clear present and
FDP bit, right?

\
 
 \ /
  Last update: 2018-09-07 01:42    [W:0.090 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site