Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp509612lqp; Thu, 4 Apr 2024 23:38:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV6Mc8JWXXB4CAPXP/xG5gLSG7M2glTn9nbFNeBkMSK/bI1FsOOoSMw4xdv8zcV3r6JHRDk/I7Dv2ShpqbtEoESzbxUTJtnhUuMXpPKrA== X-Google-Smtp-Source: AGHT+IHQzCFwMwovov7Z9gJC53EZbU4MzMLjiTgjYNXEUF/uia5DzLbotfcFofxBJMcdlr8xvnL2 X-Received: by 2002:a05:6358:9604:b0:17e:bb98:4879 with SMTP id a4-20020a056358960400b0017ebb984879mr721178rwb.3.1712299096182; Thu, 04 Apr 2024 23:38:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712299096; cv=pass; d=google.com; s=arc-20160816; b=fgbQYh0n0rMwnm9DRYADrB46qIz54pSJDKvkO/j5EqwPloZNMz84ZVuqZwfN1bkNwp XsxvbxfoysGQc8DgVq+J/3zOayn5AIsQWPXqoBbVzSYZ38wCQTbO3zBhFc4XKVnBZDa2 4roslrcgg1ziLDvdStOpDlwDSjuBm/sIG8oCgHkoaQIVtqinscFhatDTjgv7gqpYqsBI cDy9PpUy/w/EB0KMxQjONOYv5OgCdf6wbDYRNF/aqFZM8OJdQo6QayldxNXmt72nIDDr 8/RehGFEBa0wMWjteZqt+LbUmOBFt2EZuHJhB+3ez0JOoZeGAuSmzR47Bc8c6MWFDAPY 5unA== 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=nYBlmZvCfxDiPXzoD2BqbqURGZdXD7THNfKAAFvn1H8=; fh=H9i9yI85j4lkHJI8l4JDpArAsAMHlsuzp+XuM2dIb18=; b=HsgFrnG7jZ3nc+//mXtU08nalYUxEHa0FeLOkhL6ldGyL5a5AElAwrnmac82w18Uad 5HH/H8elwhAliLxtZRbuKJr/CRnfTTyvwQZNR3sF3dlG7IYmP+hzu5ebo5M3g105FTmR pbjXMbBU3TAQ3FzSdIdxTuuCTvL8GLBDIpE3QUM8L6Ff2GN95HCl0AE5nD86CDnYtdaV xqgWmYdXAMNs8CVSdOsTtfWULZxe5LfeBFJTfEM7P6gFFRg+4cJ/nfJVef/sMOK3G06x bDVRmJemzxYSJlbl2VS0NLhhYQt5xVugqAz7q+KtvEm2T8fB8KrRtpreqfHylklP3p9X TSnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=c4PKRUYm; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-132385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132385-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s198-20020a632ccf000000b005f07f35ac2fsi851475pgs.722.2024.04.04.23.38.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 23:38:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=c4PKRUYm; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-132385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132385-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8EE9DB2614A for ; Fri, 5 Apr 2024 03:30:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 342811C69E; Fri, 5 Apr 2024 03:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="c4PKRUYm" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 DFA53171BB; Fri, 5 Apr 2024 03:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712287812; cv=none; b=atbz/TL8B/21hKxX+ihqYaB10NKMvHaMoSZRa2XdFuhjdFFQYnmqQdkRQPORQlIE602ymXtq52SrC2qjtfzL8PwMhF8eSEbNcFf+Wiq17VDoHyhDoiZDQxzTWlCIf5FdHoMY8gmbADPCEqc/8BGgj5xdBmmm7H1p31IMI+80yAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712287812; c=relaxed/simple; bh=9S5aVYYlu5b0KrEcvJvCPbhRHx5GpSovTdOY1LLeUPQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GOQo4Yr3tsR7ZIJJnswzYaNt/66BqC02woqxDzIfONILY5YgvdICjrkXKoe3tRL1KUgodw9XCjf1YMb6693RPhi4OAzqOZhbA5yggFUZUOfYMKRHQ+HT/N1w3rykyUv1diX1FWSpO3fZYPP/oMEMLgoT+XEY/CbzcoRSm+XRE3I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=c4PKRUYm; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=nYBlmZvCfxDiPXzoD2BqbqURGZdXD7THNfKAAFvn1H8=; b=c4PKRUYm0vWrldtHRDUvi96coi TUywfXMyhbUrd8MKHAHGS9hGmdD29iIsIqaBICKWb5zDiMo6p8r8+QrezGG4Xzyo0AYgz0y+2rGPe SinGuvf4s+J3v16SXltvM0HFS8AL/GIwXlEr1dOsEAowHyL1nMvI29akqz5O5TnfvpTLG12n1PoV5 ZhgDu75wJCDPhoyGB1DUXK7ZsQg9XANxgc65w4HYeM6QD/Kmd5N5oaZWQvN3VdzcP2apljjz9ohx1 weSahDMBUUV62a6NWMLBWXpugzS+gvyD6Gqki9VtvLESXqjuqssEUPoqdln6hSrH/ZWQIQWQhjKZl SDA8shfw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsaH6-00000009WHm-2K1c; Fri, 05 Apr 2024 03:29:56 +0000 Date: Fri, 5 Apr 2024 04:29:56 +0100 From: Matthew Wilcox To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Janosch Frank , Claudio Imbrenda , Gerald Schaefer , Thomas Huth Subject: Re: [PATCH v1 2/5] s390/uv: convert gmap_make_secure() to work on folios Message-ID: References: <20240404163642.1125529-1-david@redhat.com> <20240404163642.1125529-3-david@redhat.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=us-ascii Content-Disposition: inline In-Reply-To: <20240404163642.1125529-3-david@redhat.com> On Thu, Apr 04, 2024 at 06:36:39PM +0200, David Hildenbrand wrote: > + /* We might get PTE-mapped large folios; split them first. */ > + if (folio_test_large(folio)) { > + rc = -E2BIG; We agree to this point. I just turned this into -EINVAL. > > + if (rc == -E2BIG) { > + /* > + * Splitting might fail with -EBUSY due to unexpected folio > + * references, just like make_folio_secure(). So handle it > + * ahead of time without the PTL being held. > + */ > + folio_lock(folio); > + rc = split_folio(folio); > + folio_unlock(folio); > + folio_put(folio); > + } Ummm ... if split_folio() succeeds, aren't we going to return 0 from this function, which will be interpreted as make_folio_secure() having succeeded?