From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Bennée Date: Thu, 08 Aug 2024 16:18:17 +0100 Subject: [PATCH v12 13/84] KVM: Annotate that all paths in hva_to_pfn() might sleep In-Reply-To: (Sean Christopherson's message of "Thu, 8 Aug 2024 06:16:46 -0700") References: <20240726235234.228822-1-seanjc@google.com> <20240726235234.228822-14-seanjc@google.com> <87bk23ql6n.fsf@draig.linaro.org> Message-ID: <877ccrqc06.fsf@draig.linaro.org> List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sean Christopherson writes: > On Thu, Aug 08, 2024, Alex Benn?e wrote: >> Sean Christopherson writes: >> >> > Now that hva_to_pfn() no longer supports being called in atomic context, >> > move the might_sleep() annotation from hva_to_pfn_slow() to >> > hva_to_pfn(). >> >> The commentary for hva_to_pfn_fast disagrees. >> >> /* >> * The fast path to get the writable pfn which will be stored in @pfn, >> * true indicates success, otherwise false is returned. It's also the >> * only part that runs if we can in atomic context. >> */ >> static bool hva_to_pfn_fast(struct kvm_follow_pfn *kfp, kvm_pfn_t *pfn) >> >> At which point did it loose the ability to run in the atomic context? I >> couldn't work it out from the commits. > > It didn't lose the ability per se (calling hva_to_pfn_fast() in atomic context > would still be functionally ok), rather the previous patch > > KVM: Drop @atomic param from gfn=>pfn and hva=>pfn APIs > > removed support for doing so in order to simplify hva_to_pfn() as a whole. It still sticks out given the only caller no longer enforces this. How about: * true indicates success, otherwise false is returned. It's also the * only part that could run in an atomic context if we wanted to * (although no callers expect it to). ? -- Alex Benn?e Virtualisation Tech Lead @ Linaro From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DB7F18E776 for ; Thu, 8 Aug 2024 15:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723130303; cv=none; b=jbsoagzq+AmbUOjmTuAUz17AprIQsd18yQHnUHTzfInB8HbqfyGpN5JzxBuwoMcc8usHYdWzK3tZjbruUziBhobJ2M76axhESj+0qOlSp+hqeMhmeQ1XfU2PvJ73Leyvo0DltIH9kXKp5TKncRT04jX54LWMZirO94w5H36bfLA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723130303; c=relaxed/simple; bh=JIv1oe8oudJUiS44KwPc6LaXFpIpf2hHYtHrt3Gk7Fs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=anx+7ihgU4dlJBnS3GKKQUiH/keCmCS2LAImU7MfWqVfbbL10DFyN8kQ60qXxD+AENezXTjswmHmGWUpqMT6KZduB6IkhHXXNU7f7ytg59M+zlade4uK8JDZK2x2oTX/7rnENDGVWsJu/vlglA3b9wAf6ySLxW3lsXYwi5J3960= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=IpylZV/j; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IpylZV/j" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4280bca3960so8156245e9.3 for ; Thu, 08 Aug 2024 08:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723130300; x=1723735100; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tobJ9z30Evl1jF8OZuU4Lc5uAJoWjkGhLZnI88VCnqo=; b=IpylZV/jbeFloUMJ8p4AzhqGfwrUM9Nc8387VAWtk1Mg1CadXPWcIPQqCXE+yUJ2hv 9TLS0IQb0wY9tiDkLUfN4uvlmaFWvzNB9FlvpBhKQ4YKw25SUaNVPjaAqL394UM/3oyX CpAlMqX0tKjZkn1upshNAt/O8blshQR79ejhv6VhwyLvDdAyGZttgHrADelA/9haBqkg 7N1dKxnYeRogEIU2aji7dbZ7yo0BXUGme9jXPG2Eq6lJDXFG5fULn+Ha5F9NpM+r9pHH XdkwRLiLfCf6fk2kOsVPwPOkYAKMYVv8ENPibE0FRJhCCyly/wJNUy9CK3+m90oYmfGO LZqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723130300; x=1723735100; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tobJ9z30Evl1jF8OZuU4Lc5uAJoWjkGhLZnI88VCnqo=; b=izKfPlA6PAon6DJmhc4H3k8Pq23ICKAKeUVYXgUpjWE2dcg3M4Krle+SGWCgasaVCB iqeYL5DI54fGm036WfJ5jYBasV60KdCbl9W9KeFwUTIswcFjadMwis4SMH1gp8lRf0Aa EJTCFBAfCoJqpRe7JPxPduEPrze/o+8Okfr3gQ9LU7I6PifIVIgWTD8EdzlwleqU8n0p 9lshdsFJm8599ZaO90DPZ6zMQHoVzViOpdWpFQUM1s7c4bFQtVoaQnPNhebK4QKTduMT ruQvz80+Q9p6abURKPEvYjCdcx20DHP+McglgMFOPVn4LVyBWQLp24rFFSfjlbCzJQSd Ei2g== X-Forwarded-Encrypted: i=1; AJvYcCV8OPMDAJlHE/4PWPtTdI0JPO+45na9U8QhFySTdKNrReU86qBrtAKXo07/1mxeowVGmidi90U=@lists.linux.dev X-Gm-Message-State: AOJu0YzT5Q9BO0qp1V9PBBC62v55N/TY3Y4G5B+8Z+DlEHs6Cbia1kvC CMZvtEZiXnGEZWHo8QuH0SzFI14YmN+IXCWjEQ6UaZaRHEI2KSNQ5Glrh+ucX5k= X-Google-Smtp-Source: AGHT+IGvryFhFZyruwyY4esgEivQLYITNxgcfgoPAmbjFk+Vzw8kMU8OO4VMz6KIvqZ2Rys90VZ6yQ== X-Received: by 2002:a05:600c:1914:b0:426:4f47:6037 with SMTP id 5b1f17b1804b1-4290af13367mr16171145e9.19.1723130299428; Thu, 08 Aug 2024 08:18:19 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429059a5dbbsm78703665e9.36.2024.08.08.08.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:18:18 -0700 (PDT) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BF0C45F769; Thu, 8 Aug 2024 16:18:17 +0100 (BST) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens Subject: Re: [PATCH v12 13/84] KVM: Annotate that all paths in hva_to_pfn() might sleep In-Reply-To: (Sean Christopherson's message of "Thu, 8 Aug 2024 06:16:46 -0700") References: <20240726235234.228822-1-seanjc@google.com> <20240726235234.228822-14-seanjc@google.com> <87bk23ql6n.fsf@draig.linaro.org> Date: Thu, 08 Aug 2024 16:18:17 +0100 Message-ID: <877ccrqc06.fsf@draig.linaro.org> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sean Christopherson writes: > On Thu, Aug 08, 2024, Alex Benn=C3=A9e wrote: >> Sean Christopherson writes: >>=20 >> > Now that hva_to_pfn() no longer supports being called in atomic contex= t, >> > move the might_sleep() annotation from hva_to_pfn_slow() to >> > hva_to_pfn(). >>=20 >> The commentary for hva_to_pfn_fast disagrees. >>=20 >> /* >> * The fast path to get the writable pfn which will be stored in @pfn, >> * true indicates success, otherwise false is returned. It's also the >> * only part that runs if we can in atomic context. >> */ >> static bool hva_to_pfn_fast(struct kvm_follow_pfn *kfp, kvm_pfn_t *pfn) >>=20 >> At which point did it loose the ability to run in the atomic context? I >> couldn't work it out from the commits. > > It didn't lose the ability per se (calling hva_to_pfn_fast() in atomic co= ntext > would still be functionally ok), rather the previous patch > > KVM: Drop @atomic param from gfn=3D>pfn and hva=3D>pfn APIs > > removed support for doing so in order to simplify hva_to_pfn() as a whole. It still sticks out given the only caller no longer enforces this.=20 How about: * true indicates success, otherwise false is returned. It's also the * only part that could run in an atomic context if we wanted to * (although no callers expect it to). ? --=20 Alex Benn=C3=A9e Virtualisation Tech Lead @ Linaro 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50490C52D7B for ; Thu, 8 Aug 2024 15:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AQStvAKzS/14IjyNAZTRd8m3HH71Yodcwa7qy3Kw3V0=; b=MqgnUGs4bjmpav i2hS4D2l7XIeM9LqnZzirEyzx3nCmus9hXRlrdoZLVTGU69sMfadspwpKJEJBtApM8NoIWF7oB/WW v07r0HyIl4PvoAsNAh/ExnDCra3tOSK44j/gRBd/0wH2KhX7FTDfm2RRh+qJ6ADIkwizd4NXjnrlB J5rf7MmbYgtcR3hoLTmGz7X0b4TsArLoSZ6llwjlOtctoORvXmsdwxzfFxTPZ87dr05Pt6D/OeF49 A4sW/LJqTHF0dpoNEaRv9bWOanpdN8fU4/WuoXEyNRfHi2ejJs5xBJ1Ul/ENpAIMIZ2mwjyFvkoyz cpFxrZzsIi+jRLMRSjUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sc4uH-00000008hBf-2E8R; Thu, 08 Aug 2024 15:18:25 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sc4uD-00000008h9f-2qia for linux-riscv@lists.infradead.org; Thu, 08 Aug 2024 15:18:23 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-428163f7635so8168855e9.2 for ; Thu, 08 Aug 2024 08:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723130300; x=1723735100; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tobJ9z30Evl1jF8OZuU4Lc5uAJoWjkGhLZnI88VCnqo=; b=kU1iypMOLnvqdo77GI54u6VhIOqBlPy7uTmocnxlf6/YheRaQkS2iwG7byo9Jdmf9T 7fDCeyrKE4rQnkTV7FDTYOMgN/CBplhrUTUsay+EAyd2Kf8+ke/W037UpBwPonFYBG+k 33+FLXunbqXsOmnnQNZVbSJaTXpbEM42vGuX48Tetr1lF0QZL6kJVV3YWjh3T+B14sjo Kt3me4WBLq37711hDl4qq5Hnesea0NcYLPzbkWpmTQ+OTr8VbY8jLs5mnryo7vR2vtVZ cVJGtFH8dlJ7qLKwJl7HmgkwlSoVD2MHYVDxoKGxyiH/0Rt0e1YhhF1X07OTmmZfNxZ4 RjRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723130300; x=1723735100; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tobJ9z30Evl1jF8OZuU4Lc5uAJoWjkGhLZnI88VCnqo=; b=FHMyGsX9vAp1huDqkLz9ZRVnrOfShLcQeAx8TGWHMa+TrYFz0Q6OH22QadJDJdWplf QoKxIlPpbmKMmSdar69SBPN9HfAqKIJruGEZi9DsRyfxY+qnJqlqezhwViVx1Xumfgr2 6i4KJBS+BEWU7ecPHAG9R1KIpzyn+maPR9QnQo3eKCl5j4hHKJK22EUjDSr4MO2Di81C Huknbu/YdgN4t3WfbHArzsdlvGykhJTSA1iBA8NMoP+V/OF7AelE1v/be/+JV5um5JK9 s1hHQ1DbLGT2HhYWY2sg3DjsqZ+wSFuR7JGS0gNDbD2f8itOXBG5ONzjy+X5GdEviLQY YXrw== X-Forwarded-Encrypted: i=1; AJvYcCUXIJk2wy+PpyCkeO5RR6Zp/gLVsu+Ab+k3oCyj8KDf+wYzRtVJFCXyaVOYMnaDH/UezNeQh2mF5kMBZQ==@lists.infradead.org X-Gm-Message-State: AOJu0YwmZy3gTmjzWHeuqLENYy7/FnqATxfRX4Px2nxJKhWit4Zqhyln bJTsp7dEU5Sgrk4HPMefsg2+UQFsrfJ6v6UFCBNoAuQ219l2GnZSo7EHtaK999w= X-Google-Smtp-Source: AGHT+IGvryFhFZyruwyY4esgEivQLYITNxgcfgoPAmbjFk+Vzw8kMU8OO4VMz6KIvqZ2Rys90VZ6yQ== X-Received: by 2002:a05:600c:1914:b0:426:4f47:6037 with SMTP id 5b1f17b1804b1-4290af13367mr16171145e9.19.1723130299428; Thu, 08 Aug 2024 08:18:19 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429059a5dbbsm78703665e9.36.2024.08.08.08.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:18:18 -0700 (PDT) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BF0C45F769; Thu, 8 Aug 2024 16:18:17 +0100 (BST) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens Subject: Re: [PATCH v12 13/84] KVM: Annotate that all paths in hva_to_pfn() might sleep In-Reply-To: (Sean Christopherson's message of "Thu, 8 Aug 2024 06:16:46 -0700") References: <20240726235234.228822-1-seanjc@google.com> <20240726235234.228822-14-seanjc@google.com> <87bk23ql6n.fsf@draig.linaro.org> Date: Thu, 08 Aug 2024 16:18:17 +0100 Message-ID: <877ccrqc06.fsf@draig.linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240808_081821_911404_FC11DA3E X-CRM114-Status: GOOD ( 11.35 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org U2VhbiBDaHJpc3RvcGhlcnNvbiA8c2VhbmpjQGdvb2dsZS5jb20+IHdyaXRlczoKCj4gT24gVGh1 LCBBdWcgMDgsIDIwMjQsIEFsZXggQmVubsOpZSB3cm90ZToKPj4gU2VhbiBDaHJpc3RvcGhlcnNv biA8c2VhbmpjQGdvb2dsZS5jb20+IHdyaXRlczoKPj4gCj4+ID4gTm93IHRoYXQgaHZhX3RvX3Bm bigpIG5vIGxvbmdlciBzdXBwb3J0cyBiZWluZyBjYWxsZWQgaW4gYXRvbWljIGNvbnRleHQsCj4+ ID4gbW92ZSB0aGUgbWlnaHRfc2xlZXAoKSBhbm5vdGF0aW9uIGZyb20gaHZhX3RvX3Bmbl9zbG93 KCkgdG8KPj4gPiBodmFfdG9fcGZuKCkuCj4+IAo+PiBUaGUgY29tbWVudGFyeSBmb3IgaHZhX3Rv X3Bmbl9mYXN0IGRpc2FncmVlcy4KPj4gCj4+ICAgLyoKPj4gICAgKiBUaGUgZmFzdCBwYXRoIHRv IGdldCB0aGUgd3JpdGFibGUgcGZuIHdoaWNoIHdpbGwgYmUgc3RvcmVkIGluIEBwZm4sCj4+ICAg ICogdHJ1ZSBpbmRpY2F0ZXMgc3VjY2Vzcywgb3RoZXJ3aXNlIGZhbHNlIGlzIHJldHVybmVkLiAg SXQncyBhbHNvIHRoZQo+PiAgICAqIG9ubHkgcGFydCB0aGF0IHJ1bnMgaWYgd2UgY2FuIGluIGF0 b21pYyBjb250ZXh0Lgo+PiAgICAqLwo+PiAgIHN0YXRpYyBib29sIGh2YV90b19wZm5fZmFzdChz dHJ1Y3Qga3ZtX2ZvbGxvd19wZm4gKmtmcCwga3ZtX3Bmbl90ICpwZm4pCj4+IAo+PiBBdCB3aGlj aCBwb2ludCBkaWQgaXQgbG9vc2UgdGhlIGFiaWxpdHkgdG8gcnVuIGluIHRoZSBhdG9taWMgY29u dGV4dD8gSQo+PiBjb3VsZG4ndCB3b3JrIGl0IG91dCBmcm9tIHRoZSBjb21taXRzLgo+Cj4gSXQg ZGlkbid0IGxvc2UgdGhlIGFiaWxpdHkgcGVyIHNlIChjYWxsaW5nIGh2YV90b19wZm5fZmFzdCgp IGluIGF0b21pYyBjb250ZXh0Cj4gd291bGQgc3RpbGwgYmUgZnVuY3Rpb25hbGx5IG9rKSwgcmF0 aGVyIHRoZSBwcmV2aW91cyBwYXRjaAo+Cj4gICBLVk06IERyb3AgQGF0b21pYyBwYXJhbSBmcm9t IGdmbj0+cGZuIGFuZCBodmE9PnBmbiBBUElzCj4KPiByZW1vdmVkIHN1cHBvcnQgZm9yIGRvaW5n IHNvIGluIG9yZGVyIHRvIHNpbXBsaWZ5IGh2YV90b19wZm4oKSBhcyBhIHdob2xlLgoKSXQgc3Rp bGwgc3RpY2tzIG91dCBnaXZlbiB0aGUgb25seSBjYWxsZXIgbm8gbG9uZ2VyIGVuZm9yY2VzIHRo aXMuIAoKSG93IGFib3V0OgoKICAgICogdHJ1ZSBpbmRpY2F0ZXMgc3VjY2Vzcywgb3RoZXJ3aXNl IGZhbHNlIGlzIHJldHVybmVkLiAgSXQncyBhbHNvIHRoZQogICAgKiBvbmx5IHBhcnQgdGhhdCBj b3VsZCBydW4gaW4gYW4gYXRvbWljIGNvbnRleHQgaWYgd2Ugd2FudGVkIHRvCiAgICAqIChhbHRo b3VnaCBubyBjYWxsZXJzIGV4cGVjdCBpdCB0bykuCgo/CgotLSAKQWxleCBCZW5uw6llClZpcnR1 YWxpc2F0aW9uIFRlY2ggTGVhZCBAIExpbmFybwoKX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX18KbGludXgtcmlzY3YgbWFpbGluZyBsaXN0CmxpbnV4LXJpc2N2 QGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1hbi9s aXN0aW5mby9saW51eC1yaXNjdgo= 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8225CC3DA4A for ; Thu, 8 Aug 2024 15:19:08 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wovqsNrz; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WfrL30wdpz2y92 for ; Fri, 9 Aug 2024 01:19:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wovqsNrz; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linaro.org (client-ip=2a00:1450:4864:20::32c; helo=mail-wm1-x32c.google.com; envelope-from=alex.bennee@linaro.org; receiver=lists.ozlabs.org) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4WfrKF5qDWz2y0K for ; Fri, 9 Aug 2024 01:18:23 +1000 (AEST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-428085a3ad1so8235105e9.1 for ; Thu, 08 Aug 2024 08:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723130300; x=1723735100; darn=lists.ozlabs.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tobJ9z30Evl1jF8OZuU4Lc5uAJoWjkGhLZnI88VCnqo=; b=wovqsNrzt1kWe5v/KPe9sy0ZDiVvaPK7k001xLTqru2BDpJMz/M2CQztc1AbMqRxuB ogEUdb1GIu1BRxGdQhDdroLRZZ7HniGTW7QBCo5dJXa3MvAvVEK9Z1tf38ZDFxVE6gp3 PFSMDGLU2TTrBfQ/WDsw494KbU+9NVqEmOdfkZDxuqnWeORM2KtERC6is0NJV5VAu1Wi wLT7rtpMYoPVwYSnJKbZK+KJgpuSbPLjYYbbsxEzlsC1v0ETNFnanNCmuGRSOZUzNBZp 251RqeFXTJY/Be6jBnB552cU9s9UJfS0dbHprlMAI3g1CybXWfYKUZ3EW572EFud26Ab CMBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723130300; x=1723735100; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tobJ9z30Evl1jF8OZuU4Lc5uAJoWjkGhLZnI88VCnqo=; b=SnDD1lLRuRbbv3iei0MWXCCj+Khp8QpoAX/17xnVB9TyyO40wChfNs7q0UgyQeh1zv huHW42ldYgX/ixxk1L1oRaBzM574gux9C3O833MMQ8E7S6WyoH4ZmjoICuOkbVAo8mTg A3TH9m0Gl5wKEYjUVuTOWJg696ZCFfZgdCbvyKCyUBHRf7ixwjR3tN1/1IqJrVrf3SqM ECb3yoOf3p6WdKAQnSp1V89Cgg98zf3gOp1MDjTiU4p9M5BwSbCBIFoDzzz4v7K1mzL9 07dLsRDn7zAzMOk+8eFIAOd2m9PQ2YQA9KvlKPmRULGh1rS9NPdlzxSaa/7poCUwgKui WOhQ== X-Forwarded-Encrypted: i=1; AJvYcCWq0Rk/pjnKUhhVrnwsjA2pYrfOmf1rkrpUx2xEi9xkoIMTtZxtxkXFG5DkaoaUIvyZC8wsR51xVOZ6ZN4=@lists.ozlabs.org X-Gm-Message-State: AOJu0Yz8n1EVSlG2GFk9a6LJOW39ZV1D9a3fIMXw1ipI+SHkwD9wJIcm u4ezRw652CznogFWsClfOj/Gh1/tfPKPTuu0Rpv7UZkEBR1Ny5RODMNSPxFgwxA= X-Google-Smtp-Source: AGHT+IGvryFhFZyruwyY4esgEivQLYITNxgcfgoPAmbjFk+Vzw8kMU8OO4VMz6KIvqZ2Rys90VZ6yQ== X-Received: by 2002:a05:600c:1914:b0:426:4f47:6037 with SMTP id 5b1f17b1804b1-4290af13367mr16171145e9.19.1723130299428; Thu, 08 Aug 2024 08:18:19 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429059a5dbbsm78703665e9.36.2024.08.08.08.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:18:18 -0700 (PDT) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BF0C45F769; Thu, 8 Aug 2024 16:18:17 +0100 (BST) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Sean Christopherson Subject: Re: [PATCH v12 13/84] KVM: Annotate that all paths in hva_to_pfn() might sleep In-Reply-To: (Sean Christopherson's message of "Thu, 8 Aug 2024 06:16:46 -0700") References: <20240726235234.228822-1-seanjc@google.com> <20240726235234.228822-14-seanjc@google.com> <87bk23ql6n.fsf@draig.linaro.org> Date: Thu, 08 Aug 2024 16:18:17 +0100 Message-ID: <877ccrqc06.fsf@draig.linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , linux-riscv@lists.infradead.org, Claudio Imbrenda , Janosch Frank , Marc Zyngier , Huacai Chen , Christian Borntraeger , Albert Ou , Bibo Mao , loongarch@lists.linux.dev, Paul Walmsley , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Oliver Upton , Palmer Dabbelt , David Stevens , kvm-riscv@lists.infradead.org, Anup Patel , Paolo Bonzini , Tianrui Zhao , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Sean Christopherson writes: > On Thu, Aug 08, 2024, Alex Benn=C3=A9e wrote: >> Sean Christopherson writes: >>=20 >> > Now that hva_to_pfn() no longer supports being called in atomic contex= t, >> > move the might_sleep() annotation from hva_to_pfn_slow() to >> > hva_to_pfn(). >>=20 >> The commentary for hva_to_pfn_fast disagrees. >>=20 >> /* >> * The fast path to get the writable pfn which will be stored in @pfn, >> * true indicates success, otherwise false is returned. It's also the >> * only part that runs if we can in atomic context. >> */ >> static bool hva_to_pfn_fast(struct kvm_follow_pfn *kfp, kvm_pfn_t *pfn) >>=20 >> At which point did it loose the ability to run in the atomic context? I >> couldn't work it out from the commits. > > It didn't lose the ability per se (calling hva_to_pfn_fast() in atomic co= ntext > would still be functionally ok), rather the previous patch > > KVM: Drop @atomic param from gfn=3D>pfn and hva=3D>pfn APIs > > removed support for doing so in order to simplify hva_to_pfn() as a whole. It still sticks out given the only caller no longer enforces this.=20 How about: * true indicates success, otherwise false is returned. It's also the * only part that could run in an atomic context if we wanted to * (although no callers expect it to). ? --=20 Alex Benn=C3=A9e Virtualisation Tech Lead @ Linaro