From patchwork Wed Aug 17 00:36:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12945372 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8401C25B0E for ; Wed, 17 Aug 2022 00:36:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E3E18D0007; Tue, 16 Aug 2022 20:36:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 493F08D0001; Tue, 16 Aug 2022 20:36:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 226308D0007; Tue, 16 Aug 2022 20:36:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 07B5A8D0001 for ; Tue, 16 Aug 2022 20:36:25 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CAFFA12020A for ; Wed, 17 Aug 2022 00:36:24 +0000 (UTC) X-FDA: 79807218288.07.E707EAB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 7262E1C0064 for ; Wed, 17 Aug 2022 00:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660696583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BTwL0O3UlpIIc32A0xilckqyKglNDPBffWl5+tmKDhQ=; b=e32xX1zB2/sFQGWAcl6fZISWESY9sEhB4FOHh/81bzoXUVktAsojJLAjxY+Pj4rHxs18cP kW6C7qZfGQUm0L6uahQ2pmRIG2QJm3RzxLb7UNpONeIw7u4LCMdFMnIfB4+Y+tBFbktcNs WIp9Y6uWKzmv0TYUsoNZs6IbfXQGu60= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-175-A1TjNU6rM7GCIMBcntTVmA-1; Tue, 16 Aug 2022 20:36:20 -0400 X-MC-Unique: A1TjNU6rM7GCIMBcntTVmA-1 Received: by mail-qk1-f197.google.com with SMTP id q20-20020a05620a0d9400b006b6540e8d79so10557333qkl.14 for ; Tue, 16 Aug 2022 17:36:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=BTwL0O3UlpIIc32A0xilckqyKglNDPBffWl5+tmKDhQ=; b=EvdcQCdr54ZaL9L54OjFB44u6M+HDKPBK/DJS4oGv1omlfhG0XQbM6rJkQvMe+lsn6 6+c62UaA0FsBNM0bjLtv5ylFwG+AywOnqKuQby0yCa+1qHhJt038CRMxVfMjP5e3p9JX Uk7ugR+DlToRvxbEVBFap8jZr45IqOu0ZjOoiQrM0smvjbZZy1aSMzoLGoInvjI1RuzH F8dO95988ucR8CBMcSNEwhWpDZL9q8lHsQR2pHPsyyqkHVfC6BSGIirj8vPr7plaV90h KglX51+I6aR5QeRcawp0c80IfEhzvOlb4HbJG1cwGAxbn3APDRfGkGra1qSOKnq1cEQ/ tUTg== X-Gm-Message-State: ACgBeo2VmEWGFAleEXjkr0pnflggKUUud9lbCASEqGpjbgElZHK4CYp/ eV1nU/VFytJzDRKNO2DGmp0iyh5aqjuRRMgyXb+badLc/V5D1EZi0QGn5rzwozG234IZvW/S7/p t6Aftf01Zw9E= X-Received: by 2002:ad4:4ead:0:b0:474:7bba:9865 with SMTP id ed13-20020ad44ead000000b004747bba9865mr20428360qvb.58.1660696580456; Tue, 16 Aug 2022 17:36:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4UUHOe8O6QFGIYvp/9K2vK0n6Fp6ajMCcyZcBb9hv+otrDbdfVJjGZcpSZ0cwahduBZbENsw== X-Received: by 2002:ad4:4ead:0:b0:474:7bba:9865 with SMTP id ed13-20020ad44ead000000b004747bba9865mr20428347qvb.58.1660696580285; Tue, 16 Aug 2022 17:36:20 -0700 (PDT) Received: from localhost.localdomain (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id c13-20020ac87dcd000000b0034358bfc3c8sm12007175qte.67.2022.08.16.17.36.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Aug 2022 17:36:19 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson , David Hildenbrand , Andrew Morton , Andrea Arcangeli , peterx@redhat.com, Paolo Bonzini , "Dr . David Alan Gilbert" , Linux MM Mailing List , John Hubbard Subject: [PATCH v3 3/3] kvm/x86: Allow to respond to generic signals during slow page faults Date: Tue, 16 Aug 2022 20:36:14 -0400 Message-Id: <20220817003614.58900-4-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220817003614.58900-1-peterx@redhat.com> References: <20220817003614.58900-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e32xX1zB; spf=pass (imf18.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660696584; a=rsa-sha256; cv=none; b=OoSDwckreZjSSzENPUgQiVN2+DW9Vo7TITU1/F3Iu93EkAKtpvJVPtjXxpRPvmeaUkOTbH PWI33UtpMynLNkNYnQrRbExevwpFTc4oa53hmYoT5NNZPEfPiL1MqIfq97+M99SnTi6bEi T5YSQLa/FMmqpdQT3bwhBpC1p+URXuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660696584; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BTwL0O3UlpIIc32A0xilckqyKglNDPBffWl5+tmKDhQ=; b=XHl5skf5QuNkKRMxaHSli8UFUJmftaS8NQgwCDNAJyF4CbDhJ21Olz7Np3YTZeOhxbbq5K b1Isjybt032w/y1QTaeSEk9QI2zELhvEDZuzrNI/zYxJJG95WF4DgleFygMngy0HkCs9R9 QUdkJBrLvYrOTZ2TIStZ3B4ntmsWaYk= Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e32xX1zB; spf=pass (imf18.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: wxw5t11g6na6bjxo3qf7yzp77111ejue X-Rspamd-Queue-Id: 7262E1C0064 X-HE-Tag: 1660696584-733164 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Enable x86 slow page faults to be able to respond to non-fatal signals. Signed-off-by: Peter Xu --- arch/x86/kvm/mmu/mmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 23dc46da2f18..4a7d387a762a 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4177,7 +4177,12 @@ static int kvm_faultin_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) } } - fault->pfn = __gfn_to_pfn_memslot(slot, fault->gfn, false, false, NULL, + /* + * Allow gup to bail on pending non-fatal signals when it's also allowed + * to wait for IO. Note, gup always bails if it is unable to quickly + * get a page and a fatal signal, i.e. SIGKILL, is pending. + */ + fault->pfn = __gfn_to_pfn_memslot(slot, fault->gfn, false, true, NULL, fault->write, &fault->map_writable, &fault->hva); return RET_PF_CONTINUE;