From patchwork Fri Jul 26 23:51:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13743437 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 36718C3DA4A for ; Fri, 26 Jul 2024 23:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=G8vTlhvtYFVN9mhfz5x+cQCHJ6x1sNjhm2Vdu8bZ6Vo=; b=fFcfJJZ2E+cSQu5lUDrEC16Wmb j/8PJqE2w4e6RmOZf6/afy078imxTA0/3G3lQe5Bbm0r6xkuqNM1xNvamZoEi/FHi09ZgGNivgt8K WzVpYj5E30ZQIYfDkSYNwwi8XvcsyO1UZ4WiI7DKAMNNCwXUPt1fdgWUYlI3+8KR15iKMs8dJoYO+ 6xMK8LNvNuxiBiPCn8Xade0UARQn/2rilMANL/RylZI7mojvuYUUWdDeqpiYBFPpLYwacBoHNi0rZ qCcOMNdN8ztXjh/fPzQcQt4VljU53NNjqJj7z9ENRBydCGCod5HYnLugcI4+7HSXRLpRogLD8wRI/ tvJcDWeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUpe-00000005TBZ-405Z; Fri, 26 Jul 2024 23:58:42 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUkD-00000005PRH-1MeP for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 23:53:09 +0000 Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1fc6a863751so9698365ad.2 for ; Fri, 26 Jul 2024 16:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722037984; x=1722642784; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=G8vTlhvtYFVN9mhfz5x+cQCHJ6x1sNjhm2Vdu8bZ6Vo=; b=Nu+8mYXFrYQ5YGwtZj98aR8Bpk4QcMuLT6l7jV9IsZjg3lTutavr/cvyPs6tcwrFs8 KPWEPH8Amfj9zJmEfsrHoTcXY4sA6UPjsP0m5qqmhPjweB5/7J7uQMeLfoQtFXp3qmce a0wxJeC7vcAYd1cpEq9sri3nrvZycIeKbX3BbeQJVjVwqeA66HSueDrGq8exAFokz9mx ahpm6ZNkiRGaN34K+NkIXW997l2nYvEe1zRd7cTp2k8cACI5pbJsPNdN3R4nVsrLpk9L /bjZCyhwuppDXmcy7IV+A2B7ix5Hj+EWUZWdbOkPk+nfftcc9iq/AoN2ad7zUCqXM8Ih bPqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722037984; x=1722642784; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=G8vTlhvtYFVN9mhfz5x+cQCHJ6x1sNjhm2Vdu8bZ6Vo=; b=NBeLkYjLde6Ne0oGGwylqZs7aU5Drm40/mAEf0QeH0J8IcaGMxqEOC0xCr4ZTM1gOH uUyfVoYQmlkRkFOAJx/uf6N9KycvpxDi6WinW2ZC7POIUZ6A1s7B2abdaBI4j4m3/vZo pZAy11hVWghMpsgstjQ0Mcdgw534ObEtrcn/QcV7RMGD/nwibDlu+a3LQ0rp0U99wKGz azDkTjCsF28FEJD3er4jF5eLmntAQNUJe0eo+6OT41b7uJ8fBRPOAjjtm0nr9SDJyhMY AF2PNp1HG3Csw4EijLIMzYMB8Gzt8c6Dv5HfHD9UZ+wubCjvQis9uX64G+uwMmYByNx9 b92A== X-Forwarded-Encrypted: i=1; AJvYcCVZXCp4MMUlWiGUAShZ+1A/LzarHbJ8/x+JxsJkviGKqUpbB63HKf5ktBL03semO1WHad01n82dEMvxtoVP8aTA8aAfd3xfktU61MLBhUI+zIkbaLk= X-Gm-Message-State: AOJu0YymZ8jrvDkfwphSxC8Lng3EOpWsclUgJxH6u84reECyCXJR9OuF Q7Np7hJx51rleA+fA60iPLN+LWF4WWNz5LD+mwcNJa2gWFc+gM4Qo+XUKdlVB9rWneGuqFS9UQy ELw== X-Google-Smtp-Source: AGHT+IGcvEjw3oRLgbDLJZa9I5d4JQMYDdZeA/FUbXpEzYyt5G6Xd+JdRMAKGNKsfMlLtXc62VqHMV40c8I= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:234e:b0:1f6:2964:17b8 with SMTP id d9443c01a7336-1ff0492c71fmr137005ad.10.1722037983933; Fri, 26 Jul 2024 16:53:03 -0700 (PDT) Date: Fri, 26 Jul 2024 16:51:22 -0700 In-Reply-To: <20240726235234.228822-1-seanjc@google.com> Mime-Version: 1.0 References: <20240726235234.228822-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog Message-ID: <20240726235234.228822-14-seanjc@google.com> Subject: [PATCH v12 13/84] KVM: Annotate that all paths in hva_to_pfn() might sleep From: Sean Christopherson To: 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 , Sean Christopherson Cc: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_165305_535900_C8FAC2AC X-CRM114-Status: GOOD ( 11.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(). Signed-off-by: Sean Christopherson Reviewed-by: Alex Bennée --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 84c73b4fc804..03af1a0090b1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2807,8 +2807,6 @@ static int hva_to_pfn_slow(unsigned long addr, bool *async, bool write_fault, struct page *page; int npages; - might_sleep(); - if (writable) *writable = write_fault; @@ -2947,6 +2945,8 @@ kvm_pfn_t hva_to_pfn(unsigned long addr, bool interruptible, bool *async, kvm_pfn_t pfn; int npages, r; + might_sleep(); + if (hva_to_pfn_fast(addr, write_fault, writable, &pfn)) return pfn;