linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Michael Kelley <mikelley@microsoft.com>,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
	luto@kernel.org, peterz@infradead.org, thomas.lendacky@amd.com,
	sathyanarayanan.kuppuswamy@linux.intel.com,
	kirill.shutemov@linux.intel.com, seanjc@google.com,
	rick.p.edgecombe@intel.com, linux-kernel@vger.kernel.org,
	linux-hyperv@vger.kernel.org, x86@kernel.org
Cc: oe-kbuild-all@lists.linux.dev, mikelley@microsoft.com
Subject: Re: [PATCH 3/5] x86/mm: Mark CoCo VM pages not present while changing encrypted state
Date: Sat, 30 Sep 2023 07:13:06 +0800	[thread overview]
Message-ID: <202309300620.S7uwOfcg-lkp@intel.com> (raw)
In-Reply-To: <1696011549-28036-4-git-send-email-mikelley@microsoft.com>

Hi Michael,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/master]
[also build test ERROR on tip/auto-latest linus/master v6.6-rc3 next-20230929]
[cannot apply to tip/x86/mm tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Michael-Kelley/x86-coco-Use-slow_virt_to_phys-in-page-transition-hypervisor-callbacks/20230930-041800
base:   tip/master
patch link:    https://lore.kernel.org/r/1696011549-28036-4-git-send-email-mikelley%40microsoft.com
patch subject: [PATCH 3/5] x86/mm: Mark CoCo VM pages not present while changing encrypted state
config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20230930/202309300620.S7uwOfcg-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/202309300620.S7uwOfcg-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/202309300620.S7uwOfcg-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/x86/mm/pat/set_memory.c: In function '__set_memory_enc_pgtable':
>> arch/x86/mm/pat/set_memory.c:2200:16: error: implicit declaration of function 'set_memory_p'; did you mean 'set_memory_np'? [-Werror=implicit-function-declaration]
    2200 |         return set_memory_p(&addr, numpages);
         |                ^~~~~~~~~~~~
         |                set_memory_np
   cc1: some warnings being treated as errors


vim +2200 arch/x86/mm/pat/set_memory.c

  2132	
  2133	/*
  2134	 * __set_memory_enc_pgtable() is used for the hypervisors that get
  2135	 * informed about "encryption" status via page tables.
  2136	 */
  2137	static int __set_memory_enc_pgtable(unsigned long addr, int numpages, bool enc)
  2138	{
  2139		pgprot_t empty = __pgprot(0);
  2140		struct cpa_data cpa;
  2141		int ret;
  2142	
  2143		/* Should not be working on unaligned addresses */
  2144		if (WARN_ONCE(addr & ~PAGE_MASK, "misaligned address: %#lx\n", addr))
  2145			addr &= PAGE_MASK;
  2146	
  2147		memset(&cpa, 0, sizeof(cpa));
  2148		cpa.vaddr = &addr;
  2149		cpa.numpages = numpages;
  2150	
  2151		/*
  2152		 * The caller must ensure that the memory being transitioned between
  2153		 * encrypted and decrypted is not being accessed.  But if
  2154		 * load_unaligned_zeropad() touches the "next" page, it may generate a
  2155		 * read access the caller has no control over. To ensure such accesses
  2156		 * cause a normal page fault for the load_unaligned_zeropad() handler,
  2157		 * mark the pages not present until the transition is complete.  We
  2158		 * don't want a #VE or #VC fault due to a mismatch in the memory
  2159		 * encryption status, since paravisor configurations can't cleanly do
  2160		 * the load_unaligned_zeropad() handling in the paravisor.
  2161		 *
  2162		 * There's no requirement to do so, but for efficiency we can clear
  2163		 * _PAGE_PRESENT and set/clr encryption attr as a single operation.
  2164		 */
  2165		cpa.mask_set = enc ? pgprot_encrypted(empty) : pgprot_decrypted(empty);
  2166		cpa.mask_clr = enc ? pgprot_decrypted(__pgprot(_PAGE_PRESENT)) :
  2167					pgprot_encrypted(__pgprot(_PAGE_PRESENT));
  2168		cpa.pgd = init_mm.pgd;
  2169	
  2170		/* Must avoid aliasing mappings in the highmem code */
  2171		kmap_flush_unused();
  2172		vm_unmap_aliases();
  2173	
  2174		/* Flush the caches as needed before changing the encryption attr. */
  2175		if (x86_platform.guest.enc_cache_flush_required())
  2176			cpa_flush(&cpa, 1);
  2177	
  2178		ret = __change_page_attr_set_clr(&cpa, 1);
  2179		if (ret)
  2180			return ret;
  2181	
  2182		/*
  2183		 * After clearing _PAGE_PRESENT and changing the encryption attribute,
  2184		 * we need to flush TLBs to ensure no further accesses to the memory can
  2185		 * be made with the old encryption attribute (but no need to flush caches
  2186		 * again).  We could just use cpa_flush_all(), but in case TLB flushing
  2187		 * gets optimized in the cpa_flush() path use the same logic as above.
  2188		 */
  2189		cpa_flush(&cpa, 0);
  2190	
  2191		/* Notify hypervisor that we have successfully set/clr encryption attr. */
  2192		if (!x86_platform.guest.enc_status_change_finish(addr, numpages, enc))
  2193			return -EIO;
  2194	
  2195		/*
  2196		 * Now that the hypervisor is sync'ed with the page table changes
  2197		 * made here, add back _PAGE_PRESENT. set_memory_p() does not flush
  2198		 * the TLB.
  2199		 */
> 2200		return set_memory_p(&addr, numpages);
  2201	}
  2202	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2023-09-29 23:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29 18:19 [PATCH 0/5] x86/coco: Mark CoCo VM pages not present when changing encrypted state Michael Kelley
2023-09-29 18:19 ` [PATCH 1/5] x86/coco: Use slow_virt_to_phys() in page transition hypervisor callbacks Michael Kelley
2023-10-02 15:52   ` Tom Lendacky
2023-09-29 18:19 ` [PATCH 2/5] x86/mm: Don't do a TLB flush if changing a PTE that isn't marked present Michael Kelley
2023-09-29 18:19 ` [PATCH 3/5] x86/mm: Mark CoCo VM pages not present while changing encrypted state Michael Kelley
2023-09-29 23:13   ` kernel test robot [this message]
2023-10-02 16:35   ` Tom Lendacky
2023-10-02 18:59     ` Tom Lendacky
2023-10-02 20:43       ` Michael Kelley (LINUX)
2023-10-17  0:35         ` Michael Kelley (LINUX)
2023-09-29 18:19 ` [PATCH 4/5] x86/mm: Remove unnecessary call layer for __set_memory_enc_pgtable() Michael Kelley
2023-09-29 18:19 ` [PATCH 5/5] x86/mm: Add comments about errors in set_memory_decrypted()/encrypted() Michael Kelley
2023-10-02 15:42 ` [PATCH 0/5] x86/coco: Mark CoCo VM pages not present when changing encrypted state Tom Lendacky

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=202309300620.S7uwOfcg-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).