From: kernel test robot <lkp@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [davidhildenbrand:device_private 9/22] mm/ksm.c:1276:28: error: passing 'pte_t *' to parameter of incompatible type 'pte_t'; dereference with *
Date: Wed, 5 Feb 2025 16:47:49 +0800 [thread overview]
Message-ID: <202502051640.vYN3JWVM-lkp@intel.com> (raw)
tree: https://github.com/davidhildenbrand/linux device_private
head: ddc42f5fd72394838fc2d280ff2486ccb7178b9a
commit: e06705cb196ddea990ddec54bffd90ebff1ea85c [9/22] mm/ksm: handle device-exclusive entries correctly in write_protect_page()
config: i386-buildonly-randconfig-006-20250205 (https://download.01.org/0day-ci/archive/20250205/202502051640.vYN3JWVM-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250205/202502051640.vYN3JWVM-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502051640.vYN3JWVM-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/ksm.c:18:
include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
47 | __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
| ~~~~~~~~~~~ ^ ~~~
include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
49 | NR_ZONE_LRU_BASE + lru, nr_pages);
| ~~~~~~~~~~~~~~~~ ^ ~~~
>> mm/ksm.c:1276:28: error: passing 'pte_t *' to parameter of incompatible type 'pte_t'; dereference with *
1276 | if (unlikely(!pte_present(pvmw.pte))
| ^~~~~~~~
| *
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
arch/x86/include/asm/pgtable.h:1010:37: note: passing argument to parameter 'a' here
1010 | static inline int pte_present(pte_t a)
| ^
>> mm/ksm.c:1277:3: error: expected ')'
1277 | goto out_unlock;
| ^
mm/ksm.c:1276:5: note: to match this '('
1276 | if (unlikely(!pte_present(pvmw.pte))
| ^
2 warnings and 2 errors generated.
vim +1276 mm/ksm.c
1245
1246 static int write_protect_page(struct vm_area_struct *vma, struct folio *folio,
1247 pte_t *orig_pte)
1248 {
1249 struct mm_struct *mm = vma->vm_mm;
1250 DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, 0, 0);
1251 int swapped;
1252 int err = -EFAULT;
1253 struct mmu_notifier_range range;
1254 bool anon_exclusive;
1255 pte_t entry;
1256
1257 if (WARN_ON_ONCE(folio_test_large(folio)))
1258 return err;
1259
1260 pvmw.address = page_address_in_vma(folio, folio_page(folio, 0), vma);
1261 if (pvmw.address == -EFAULT)
1262 goto out;
1263
1264 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, pvmw.address,
1265 pvmw.address + PAGE_SIZE);
1266 mmu_notifier_invalidate_range_start(&range);
1267
1268 if (!page_vma_mapped_walk(&pvmw))
1269 goto out_mn;
1270 if (WARN_ONCE(!pvmw.pte, "Unexpected PMD mapping?"))
1271 goto out_unlock;
1272 /*
1273 * Handle PFN swap entries, such as device-exclusive ones, that
1274 * actually map pages: give up just like the next folio_walk would.
1275 */
> 1276 if (unlikely(!pte_present(pvmw.pte))
> 1277 goto out_unlock;
1278
1279 anon_exclusive = PageAnonExclusive(&folio->page);
1280 entry = ptep_get(pvmw.pte);
1281 if (pte_write(entry) || pte_dirty(entry) ||
1282 anon_exclusive || mm_tlb_flush_pending(mm)) {
1283 swapped = folio_test_swapcache(folio);
1284 flush_cache_page(vma, pvmw.address, folio_pfn(folio));
1285 /*
1286 * Ok this is tricky, when get_user_pages_fast() run it doesn't
1287 * take any lock, therefore the check that we are going to make
1288 * with the pagecount against the mapcount is racy and
1289 * O_DIRECT can happen right after the check.
1290 * So we clear the pte and flush the tlb before the check
1291 * this assure us that no O_DIRECT can happen after the check
1292 * or in the middle of the check.
1293 *
1294 * No need to notify as we are downgrading page table to read
1295 * only not changing it to point to a new page.
1296 *
1297 * See Documentation/mm/mmu_notifier.rst
1298 */
1299 entry = ptep_clear_flush(vma, pvmw.address, pvmw.pte);
1300 /*
1301 * Check that no O_DIRECT or similar I/O is in progress on the
1302 * page
1303 */
1304 if (folio_mapcount(folio) + 1 + swapped != folio_ref_count(folio)) {
1305 set_pte_at(mm, pvmw.address, pvmw.pte, entry);
1306 goto out_unlock;
1307 }
1308
1309 /* See folio_try_share_anon_rmap_pte(): clear PTE first. */
1310 if (anon_exclusive &&
1311 folio_try_share_anon_rmap_pte(folio, &folio->page)) {
1312 set_pte_at(mm, pvmw.address, pvmw.pte, entry);
1313 goto out_unlock;
1314 }
1315
1316 if (pte_dirty(entry))
1317 folio_mark_dirty(folio);
1318 entry = pte_mkclean(entry);
1319
1320 if (pte_write(entry))
1321 entry = pte_wrprotect(entry);
1322
1323 set_pte_at(mm, pvmw.address, pvmw.pte, entry);
1324 }
1325 *orig_pte = entry;
1326 err = 0;
1327
1328 out_unlock:
1329 page_vma_mapped_walk_done(&pvmw);
1330 out_mn:
1331 mmu_notifier_invalidate_range_end(&range);
1332 out:
1333 return err;
1334 }
1335
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-02-05 8:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202502051640.vYN3JWVM-lkp@intel.com \
--to=lkp@intel.com \
--cc=david@redhat.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.