Received: by 2002:a05:6a10:8a4f:0:0:0:0 with SMTP id dn15csp2601694pxb; Mon, 31 Jan 2022 03:42:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJratqD8TNF4tCvaexPO1EVDTUxJz63PrbSYt4964KIximHpOzZCLbN13wOwF9uACfL08N X-Received: by 2002:a17:90a:c250:: with SMTP id d16mr24019368pjx.244.1643629336522; Mon, 31 Jan 2022 03:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643629336; cv=none; d=google.com; s=arc-20160816; b=Y4XpVFwNHrzx8M4ZaSgH4iGHCcsww7YwN4Eh7B1FMA/Y+/c3sp1uvU83j9rQMzMArW i1zvCL7jQFfgKZ6Egx3Pd3V/vzYiox3AEV/8n2iTqeOoX9WrUcZgO/mpXmdAp/nFlgtz KNGNUboVNFCg2gceh/c9HI4y0v8Ov6EdsFAqlaUPceZzLqE99nN6kxOBLd1SwbmXlb4X zNmgeCJ6RajmEeZIagGBrnhh6Qm849CVWFs8xwUfhICNnpnrR7SKXPVgRIF/0ImMDqE2 4VUuugJdFuxsvP5PJ9y8N75cxuVYRfQrzs2eNfMXlZl2KHQtY9ij0uJSuUxNSa4Dyp+Y t40Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gEFhmZLFOnXMQveiDfoP1+6Mljbbxm8tsJX8s0nRB78=; b=kGitCzTNnVKat2cjmkvt/W/97CEkcxaJf7WtR/wy/yf7RqRtJl+j2gPWtfKn13wRQS dfw8N7SiuwfZTrYx0x5oTI5SnPjLHxsBX4QoGybPROJkKqDB3ovvafJj3kQnjmpNZvTz CCOH2eQXhFWXOKicxYWYnQMZC6X3LJ5nRxhmHBVPaW7DUDdUuZcJ2FDe28E6cFqZ8Wue qk+GvgD4LqKrD68opjciCyNZ3V/+PWm/q2mlY2BdHgsuQZ6sk2bvy2puPv/9dxZjUHZt UBCptUUAuXom4/vNLr5xLJDDuXR1m6z+0cwhg3cHUELXVkQ1/iYBLqRPmYzm0SdTlV0K m8QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZuM+rah6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i32si17604021pgi.668.2022.01.31.03.42.05; Mon, 31 Jan 2022 03:42:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZuM+rah6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351614AbiA1VsD (ORCPT + 99 others); Fri, 28 Jan 2022 16:48:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351611AbiA1Vr7 (ORCPT ); Fri, 28 Jan 2022 16:47:59 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17DD7C061714 for ; Fri, 28 Jan 2022 13:47:59 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id z131so6337184pgz.12 for ; Fri, 28 Jan 2022 13:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gEFhmZLFOnXMQveiDfoP1+6Mljbbxm8tsJX8s0nRB78=; b=ZuM+rah6VlxJjLQN6XGuzLjNMOR8gefWcnDB4s6zlMlT6qajSenVWettyIecArWDnC Fq0slbwG5XONSEXFvWzvMRN9PXT1+IBmW6lwfBLr4Q9wyOX5ambmxjvNzbI+2898WjCK tf0bZSvggWSVNk+Exkq7K5V+qAYWlclBozqSSAbbIPaMFXdD2TDQj6ziFP3Kc5c6FoAP OW4n/CPH5jbNcRJLgNSBY35il5AQS5qh8n2ID/SNJxAeIi/N40gCxCj4Si00oLlZiMGx 7T4OTsXHLOSivcWgzIWtNMKTJbdoOpXQjUfaczYJ0L39kRCHd6D/YQ/56kpj/Jz3jvAe eqEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gEFhmZLFOnXMQveiDfoP1+6Mljbbxm8tsJX8s0nRB78=; b=aKdeDCxMQaBPAloZPtAwR17A3X/xUullfgIjqJ2I8FfY5MlXla+t3hkUcVV/N0+bH+ LJJLLib515I/4CvTkDrePR/MKuxsjb9mFYtMXUcpxUN7JyZKlXPPW4n/jO35vg4UC/Ic 3usYrJ333XGOOcW/DSn14CTpaMiYSAjuA0/i7s/6YBshu9C7nnNoGiMGJzrV9KXAPZQT uRyjcVIfAjV6pvQKqeWoaHk8RTYJe5RpovZFTGUFzVCx058gF/p+ksGdbwsnSrZMvQqB iTPD4yy16IpflJ3VzzjzLr3ZlALvFomY7Vp8Lr8Ve9X8VLXpIWW0KdhzeWYEKJ495xxe SRNQ== X-Gm-Message-State: AOAM532v10PBFXos/RHFHixF2BEdj0Izttrmj4cDauSQBDN7wNHo71eS PIqyjfjW/bO4jIycBpZXN50ZrQ== X-Received: by 2002:a65:424d:: with SMTP id d13mr8034233pgq.82.1643406478387; Fri, 28 Jan 2022 13:47:58 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id v13sm9977689pfi.201.2022.01.28.13.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 13:47:57 -0800 (PST) Date: Fri, 28 Jan 2022 21:47:54 +0000 From: Sean Christopherson To: "Maciej S. Szmigiero" Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Michal Hocko , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: x86: Fix rmap allocation for very large memslots Message-ID: References: <1acaee7fa7ef7ab91e51f4417572b099caf2f400.1643405658.git.maciej.szmigiero@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1acaee7fa7ef7ab91e51f4417572b099caf2f400.1643405658.git.maciej.szmigiero@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022, Maciej S. Szmigiero wrote: > From: "Maciej S. Szmigiero" > > Commit 7661809d493b ("mm: don't allow oversized kvmalloc() calls") has > forbidden using kvmalloc() to make allocations larger than INT_MAX (2 GiB). > > Unfortunately, adding a memslot exceeding 1 TiB in size will result in rmap > code trying to make an allocation exceeding this limit. > Besides failing this allocation, such operation will also trigger a > WARN_ON_ONCE() added by the aforementioned commit. > > Since we probably still want to use kernel slab for small rmap allocations > let's only redirect such oversized allocations to vmalloc. > > A possible alternative would be to add some kind of a __GFP_LARGE flag to > skip the INT_MAX check behind kvmalloc(), however this will impact the > common kernel memory allocation code, not just KVM. Paolo has a cleaner fix for this[1][2], but it appears to have stalled out somewhere. Paolo??? [1] https://lore.kernel.org/all/20211015165519.135670-1-pbonzini@redhat.com [2] https://lore.kernel.org/all/20211016064302.165220-1-pbonzini@redhat.com