From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C43B0C77B7A for ; Sun, 14 May 2023 01:35:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F1DAA6B0071; Sat, 13 May 2023 21:35:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ECD816B0072; Sat, 13 May 2023 21:35:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D97236B0074; Sat, 13 May 2023 21:35:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CB5956B0071 for ; Sat, 13 May 2023 21:35:26 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9AEAD411CE for ; Sun, 14 May 2023 01:35:26 +0000 (UTC) X-FDA: 80787143052.25.EBEC086 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf06.hostedemail.com (Postfix) with ESMTP id D7E74180004 for ; Sun, 14 May 2023 01:35:22 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=G4Bsodxw; spf=pass (imf06.hostedemail.com: domain of lkp@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684028123; a=rsa-sha256; cv=none; b=nIUpzNgPseVohh442utiKbuTDmClm4UcKFeHS7zqjniLjFk0lv8zU8Yr8QTaP5jAHKikwf 6hpalIjaG0aVb51Fz7J7oJbn6KdLZFyrOdMsOGlafgGUhnkUKhIiTue6FmxhmM4HuRgSVT BBIvgt01N50wN7WeUMGII8KENX1RrvM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=G4Bsodxw; spf=pass (imf06.hostedemail.com: domain of lkp@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684028123; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=UbvGP/TTtQTMZmFWQRw2XfiYN8L3rj4RwD3urLc6Awk=; b=san+RU7cBoyfqeZ0qZ0UafNNxMTsvMI3Yw3NQ03r8ggaUcP4JSJ56kLj+h7IKcbD5m4GzM QEN+CqGTQL+oq252GRPbpf/kzP8TA5XKZjUDxH0iml2bRRUR3WP+TQClUoLuqRlGCEpa1d dS2UcHBj0pq2Lkpq67W0fNwrRWr2ToU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684028122; x=1715564122; h=date:from:to:cc:subject:message-id:mime-version; bh=oFxf7pWfQW7M6ceJSnS4iWuxW06jpBc8ENSBaLcR8vI=; b=G4BsodxwBnfyijsyQxrrjzblL5+f4tP8ZLIRnDiKaOcX9d80J92aaxys b/HbcMwNwWrw3V6x4MCj14ajGTVgkZLrKrUwVKgBDS8dVSnQKCUelFGMr 4HKAjCRI4xp0t1v2PxMIM3I9m9N3uegIcTbuxZAwtN3x0Zr+42AfWWvch Q6aWSHRYZGmNv/LiR4sPjyqIeFGgoNzBN6H0+VewgYMyJfjD+PS2cmhI6 aVcNLxBcelbENmTR4qZ2G+KC+ggwXv4gSaMm7rE4UwJqT5TzYnaO6B13M 3YQcdsQfaH7ST/coj/P+6aOqEOieQXk/TU4STC+g0nh0/3dg/SBCeQDar g==; X-IronPort-AV: E=McAfee;i="6600,9927,10709"; a="340335947" X-IronPort-AV: E=Sophos;i="5.99,273,1677571200"; d="scan'208";a="340335947" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2023 18:35:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10709"; a="694629462" X-IronPort-AV: E=Sophos;i="5.99,273,1677571200"; d="scan'208";a="694629462" Received: from lkp-server01.sh.intel.com (HELO dea6d5a4f140) ([10.239.97.150]) by orsmga007.jf.intel.com with ESMTP; 13 May 2023 18:35:19 -0700 Received: from kbuild by dea6d5a4f140 with local (Exim 4.96) (envelope-from ) id 1py0dq-0005m0-2W; Sun, 14 May 2023 01:35:18 +0000 Date: Sun, 14 May 2023 09:34:54 +0800 From: kernel test robot To: Lorenzo Stoakes Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Andrew Morton , Jan Kara Subject: [linux-next:master 1011/2056] mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) Message-ID: <202305140954.06aQsI9r-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspam-User: X-Stat-Signature: adzsm184tangnthdgjsh7u3kjni95t5j X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D7E74180004 X-HE-Tag: 1684028122-385478 X-HE-Meta: U2FsdGVkX18wuxW2qW4euO9gci85axc57kz15wM7/h50QL6qpzfCS+cxqwZy/qSf/RMDOW/OaoWBLpMhNk+pNP9Ev9By7rbcS8wzpJcYCMcdwz4afeNRb/BEjmn9hl+U/iuWZcyoOQOBbDO7N/Gle/qi7PXCj54KjfzQ3Ywqq7mmTN5Oye1ghXyBb8HtLFxlwJOqB1yy3R1q3nxy5aipeLFvWKR3GFdg0VmG7FC87Lp9Ei3MEH4kRj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JDpzmyJhjYPYicrM/AuZtMzEfVCCierMRrA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: e922ba281a8d84f640d8c8e18a385d032c19e185 commit: 1d313cb53d95b8d1527173bda7174e920f5a195a [1011/2056] mm/gup: disallow FOLL_LONGTERM GUP-fast writing to file-backed mappings config: loongarch-randconfig-s042-20230514 (https://download.01.org/0day-ci/archive/20230514/202305140954.06aQsI9r-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=1d313cb53d95b8d1527173bda7174e920f5a195a git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 1d313cb53d95b8d1527173bda7174e920f5a195a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Link: https://lore.kernel.org/oe-kbuild-all/202305140954.06aQsI9r-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got unsigned int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got unsigned int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got unsigned int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got unsigned int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got int [noderef] __percpu * >> mm/gup.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@ mm/gup.c:2430:9: sparse: expected void *ptr mm/gup.c:2430:9: sparse: got int [noderef] __percpu * vim +2430 mm/gup.c 2382 2383 /* 2384 * Used in the GUP-fast path to determine whether a pin is permitted for a 2385 * specific folio. 2386 * 2387 * This call assumes the caller has pinned the folio, that the lowest page table 2388 * level still points to this folio, and that interrupts have been disabled. 2389 * 2390 * Writing to pinned file-backed dirty tracked folios is inherently problematic 2391 * (see comment describing the writable_file_mapping_allowed() function). We 2392 * therefore try to avoid the most egregious case of a long-term mapping doing 2393 * so. 2394 * 2395 * This function cannot be as thorough as that one as the VMA is not available 2396 * in the fast path, so instead we whitelist known good cases and if in doubt, 2397 * fall back to the slow path. 2398 */ 2399 static bool folio_fast_pin_allowed(struct folio *folio, unsigned int flags) 2400 { 2401 struct address_space *mapping; 2402 unsigned long mapping_flags; 2403 2404 /* 2405 * If we aren't pinning then no problematic write can occur. A long term 2406 * pin is the most egregious case so this is the one we disallow. 2407 */ 2408 if ((flags & (FOLL_PIN | FOLL_LONGTERM | FOLL_WRITE)) != 2409 (FOLL_PIN | FOLL_LONGTERM | FOLL_WRITE)) 2410 return true; 2411 2412 /* The folio is pinned, so we can safely access folio fields. */ 2413 2414 if (WARN_ON_ONCE(folio_test_slab(folio))) 2415 return false; 2416 2417 /* hugetlb mappings do not require dirty-tracking. */ 2418 if (folio_test_hugetlb(folio)) 2419 return true; 2420 2421 /* 2422 * GUP-fast disables IRQs. When IRQS are disabled, RCU grace periods 2423 * cannot proceed, which means no actions performed under RCU can 2424 * proceed either. 2425 * 2426 * inodes and thus their mappings are freed under RCU, which means the 2427 * mapping cannot be freed beneath us and thus we can safely dereference 2428 * it. 2429 */ > 2430 lockdep_assert_irqs_disabled(); 2431 2432 /* 2433 * However, there may be operations which _alter_ the mapping, so ensure 2434 * we read it once and only once. 2435 */ 2436 mapping = READ_ONCE(folio->mapping); 2437 2438 /* 2439 * The mapping may have been truncated, in any case we cannot determine 2440 * if this mapping is safe - fall back to slow path to determine how to 2441 * proceed. 2442 */ 2443 if (!mapping) 2444 return false; 2445 2446 /* Anonymous folios pose no problem. */ 2447 mapping_flags = (unsigned long)mapping & PAGE_MAPPING_FLAGS; 2448 if (mapping_flags) 2449 return mapping_flags & PAGE_MAPPING_ANON; 2450 2451 /* 2452 * At this point, we know the mapping is non-null and points to an 2453 * address_space object. The only remaining whitelisted file system is 2454 * shmem. 2455 */ 2456 return shmem_mapping(mapping); 2457 } 2458 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests