Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp302129lqi; Wed, 6 Mar 2024 18:53:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXEhYODb0EkvAQwhE3V5YnpC0lSbZ6DTdgh8DhpK6GoY2wiU716EPIKGF3AwtncQReqiaqpSELGIi5BreYGYULQmPutFNbzDKxbSYPliw== X-Google-Smtp-Source: AGHT+IHrxgFPoKgFA0fT2pAxCEh9u23uOGvVtkJauBH8pJ6T2/5vJUz7opF4nmieXuEa8IOkulgS X-Received: by 2002:a05:622a:1355:b0:42e:e325:bf68 with SMTP id w21-20020a05622a135500b0042ee325bf68mr263799qtk.10.1709779987053; Wed, 06 Mar 2024 18:53:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709779987; cv=pass; d=google.com; s=arc-20160816; b=qCO90//MmQKv38fs/5FAF9bzPz6tsS0y6WhQ0u/0Ot4r0LgcqoDDJz8nW1UKBS3vLv UQVBCZLP2N2/5yG/VVX+G1zNAJCywjoKE14qKkLAgSdGYeKF2maipr/XQ/GllwObZZT+ NRj013n2sqvLrRkHxEhtKYl5AUPFbivTbj7akcKu2Iy6YCWdloBRI+2Ddz9WwHzZvcEt dccoeCL8VBve2s1zzVlwF7Euv2bw7pSYLYC9R2zDaRS5zTEfV7i3Xq4JjqxmH+sm3/C/ B/epNuADctA5F1WoQNsbFyFUAFfRQCLDclAHNjaeuAmgQLFVKelZW/q6VPvOEaKN/2aG x+NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=f/FGYQUlRVLx2nWSl+TUYjEj9OuUnJR33yzlm7SnxR4=; fh=UgqpCNH9WwmosEfqySsUNEa2pBAicm1yju45jT3AJTg=; b=wUMCIabpBFOeTOQq52ZyawRtvqpd07ICRiG5DRCWCE8gH2oKgLsacPkfWAwkAdtp9v HoY7ipVfT8uZG6Ryxxo7UKMSpdTIzSAkddk75vglZ7xW90/htxt+Z8zejeZ2ocj+auA4 1jG1Q+qCEvrUAleL7BcXf0TaheRcomWj8J0iVgt3s2ioNoFTQrHd77Znz+z+wZy7n2Ns C5d3KL1YYbQ4qk6/dqZ5Y1LSbB0BpzcdYgF2ZsQMpqc5esbMTWiXekkiSY61CbEbTyCQ PAYFAAfA2z0uUMEt1VEHvtJkDNsTeRAmG6RmOZtViaFRpVEJxn4Ri5VTa/bNv9BFF0Kp oZkw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hhQGj9ZO; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-94891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a21-20020ac85b95000000b0042c075c6f4asi11246124qta.569.2024.03.06.18.53.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 18:53:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hhQGj9ZO; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-94891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C0C571C21F72 for ; Thu, 7 Mar 2024 02:53:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7617110FD; Thu, 7 Mar 2024 02:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hhQGj9ZO" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A958A3D71; Thu, 7 Mar 2024 02:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709779976; cv=none; b=WbrxkemZAu7cFqA7G6Jotq3fpYBnjFTeyWZhJwe9Y/a+t3MljjrWFb7xg8vHlOfnLAAies9wiHntKzYxf54XKovRQYUqtH1pdAtyK0zlW4MD7p5kSHWmFfPwwGHpl5+/lBizp/LskPS5r/kY9DVoqFx7wUElhvQhHEtUJt5NxCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709779976; c=relaxed/simple; bh=2JAHTpQP0sPgir3sGjPu5gyDIuuD+wQ+e68TUz1lrTE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZY/b3zeg/6WCROv8J/ZXxdcV/Bup0MRXsIKJZUNuSmQUif8P5DQqh5G2amDqq+3fSOLh/NZCbULmhbhU44XJqRUZajUicIW9YrcyfCJetc0cBxlCz2vGzUwsjQfeRd15HbJvbgNfTGWQNRWsPZTpMjsh/0jThKF4r9SH8sCFbmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hhQGj9ZO; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709779974; x=1741315974; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=2JAHTpQP0sPgir3sGjPu5gyDIuuD+wQ+e68TUz1lrTE=; b=hhQGj9ZObZQCH3eTEx7PwrwdSJvoubf4kUdVR0FuWBDfiCMTJpBgZFsS XULzW88zor1+qXpsI6LjgohMvYBb3pIc3G8GEPNZwl38JQqLDEfBNLpD2 hxHPdnoLY2w/eIWHk1Dgm/uv91F7pa/GByvbaSGnx78hKW4248Yy837TG fhkZsjvHVYDEgfHoLgdeJ/qsUMfeR8FCdP7I/NBWenq5ONkjS9GXO/M+r LKH1fPy8KeK91nb2p/qsg6zBZ10mc1B7PtzfV2+ZTWEvTcInpPEbQwK7C e18GrYp8+e4+uugehSxK6hPz9w3msWOP0M8hHSR9N88S7suTLGHE1wORA g==; X-IronPort-AV: E=McAfee;i="6600,9927,11005"; a="8249351" X-IronPort-AV: E=Sophos;i="6.06,209,1705392000"; d="scan'208";a="8249351" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 18:52:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,209,1705392000"; d="scan'208";a="40941433" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 18:52:53 -0800 Date: Wed, 6 Mar 2024 18:52:52 -0800 From: Isaku Yamahata To: David Matlack Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, isaku.yamahata@gmail.com, linux-kernel@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Michael Roth , Federico Parola , isaku.yamahata@linux.intel.com Subject: Re: [RFC PATCH 2/8] KVM: Add KVM_MAP_MEMORY vcpu ioctl to pre-populate guest memory Message-ID: <20240307025252.GH368614@ls.amr.corp.intel.com> References: <012b59708114ba121735769de94756fa5af3204d.1709288671.git.isaku.yamahata@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Wed, Mar 06, 2024 at 04:49:19PM -0800, David Matlack wrote: > > + cond_resched(); > > + > > + r = kvm_arch_vcpu_map_memory(vcpu, mapping); > > + if (r) > > + break; > > + > > + added = true; > > + } > > + > > + srcu_read_unlock(&vcpu->kvm->srcu, idx); > > + vcpu_put(vcpu); > > + > > + if (added && mapping->nr_pages > 0) > > + r = -EAGAIN; > > This can overwrite the return value from kvm_arch_vcpu_map_memory(). This is to convert ERESTART into EAGAIN. I'll drop this check and document EINTR so that caller should be aware of partial population. -- Isaku Yamahata