Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5079710ybv; Tue, 11 Feb 2020 08:48:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxcdOOuSVs1PKi7HrHr9Zu612GZumj5QsSJU3Sbi4U6IaNalAaHNjBhm3+wdKRiyIQt5NXt X-Received: by 2002:a05:6808:487:: with SMTP id z7mr3515285oid.59.1581439711030; Tue, 11 Feb 2020 08:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581439711; cv=none; d=google.com; s=arc-20160816; b=znEytlumabbHWYUV1H+p/C6pQDzj+1YpKgSQn53KXghs2U8MMOufwjPdDIicam8T2I GDNbRF0aiKA/ldJ9fRX9oaPHAevUYiQlQ6fRP3uZWqT05HiSL/OSSEYHZcZ2zFx0Pmaj SWCzdlZUGHlBHPOkAZ1VaMO8kowJFS1LXHw6zsQOOC3rsWBgx3e3NVnRSa/NhaAJasov tk7XP3iiFiuh1j2JUCboHOLjfV1A/y9i6fIvdXuEyOcvOcIjh+ti+FlhqaSGuunq4yDn pIK2vqbD213N1QqURKwZ9W+Cz6awJwWVY+KMn/yzRy6IewSeFxsbPeXNKWUTq3QnMuEf gBUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7nfesydZoKg7wB4eAKrBh2n+G/3uidxo6nvSZCLKjmc=; b=U0xcPkSJzyupF4Uij61/QfBV7LgSoWWOz717rGiSXSONvVZj7Lk1xU/psSp8zGHPsB ybYXv++87nXb8gse3HGOI705NhhIkJKyODsyas/hs7YCmvMfaealRY4McaTNJ+NmVocN Bmd9D5L+z92qUmqoogQyNvYDvChsYDdGzrUOU14zyYV6g/5mhvPcnksxtRMfoqIQIKpU QQJlXu2BBGOFNwM1+iM6H5p5XA4da0SXPAXi+O7vLb+ZUmsFetRjGRQdS4RNpY9gBHAp NL0V18/fM/zHjVUE6eJtrY3zYdaBM4WyMeZUF4dBrs8H72b5s5C4ETluhfbUBx6ZAqYv qRnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G2Qwcsqe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si1772083oih.70.2020.02.11.08.48.14; Tue, 11 Feb 2020 08:48:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G2Qwcsqe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730272AbgBKOsz (ORCPT + 99 others); Tue, 11 Feb 2020 09:48:55 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:48142 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729041AbgBKOsz (ORCPT ); Tue, 11 Feb 2020 09:48:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581432534; 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: in-reply-to:in-reply-to:references:references; bh=7nfesydZoKg7wB4eAKrBh2n+G/3uidxo6nvSZCLKjmc=; b=G2Qwcsqe2pTU2JCLflby/hBLZNmxuLyRDhFfyOVESFDIfoAjmRyc9gGemYFLG0MVfoX1Rw Lh+bnh3s109m57H0Py88/SK7/w+33Taz/om1t5PNyNHui2zaga2wx1VCv7AqUY6uBmriFc N1EfLSZHX3MLwWjhAXyxJpvnA4K8Juo= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-MQiLjUbIMJCI0Afqd4Sa1A-1; Tue, 11 Feb 2020 09:48:52 -0500 X-MC-Unique: MQiLjUbIMJCI0Afqd4Sa1A-1 Received: by mail-qv1-f69.google.com with SMTP id d7so7280332qvq.12 for ; Tue, 11 Feb 2020 06:48:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7nfesydZoKg7wB4eAKrBh2n+G/3uidxo6nvSZCLKjmc=; b=b2iywpT8QxQqzLaSaDN/4bg9GdEsBYMuxZiYpopNY/7aOCEIM8UJ2/nV2cB7Jt2GZD wCw0MMI5gNmi0oAC9HyDeTqIohkMKl32r/ZrRtSL8KYrkUTSrL/BzoNPGIjaU0E5cE5d Cux8ZA74RjDKk3wp5HwrCetRwKu1VPK5TymuBJItgIt52Fim8oHsjV/TUtQdLRTUigeP lrmPH8hYrXtJXQrdS+eLodEXcRMFpugncXbToYFOYcxIj8C3aCdeI/AWiJvYyzWnDv8U RHxML55eJKu9lyFiYKc703n2ZVF1knxzEvgd0ZtgEy7wMp3nb7MN7KG7nNJHEuWK/6X5 mwHw== X-Gm-Message-State: APjAAAVQbqLF3vucV0+hc4uYS5c14LpSgkLazol7eCv8IOJoLgQOZQ7b TxQS7S/VUn8FJjrx/+GnC0mbOxbJlFOb28CWqvWyvuNobWVdOfDKjdwR9UU+fi1SdSuANh+Qmc4 i6SMYx0cjH3ItSPNNy/p66c0q X-Received: by 2002:a37:903:: with SMTP id 3mr3033669qkj.388.1581432532236; Tue, 11 Feb 2020 06:48:52 -0800 (PST) X-Received: by 2002:a37:903:: with SMTP id 3mr3033633qkj.388.1581432531928; Tue, 11 Feb 2020 06:48:51 -0800 (PST) Received: from redhat.com (bzq-79-176-41-183.red.bezeqint.net. [79.176.41.183]) by smtp.gmail.com with ESMTPSA id p18sm2137225qkp.47.2020.02.11.06.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 06:48:51 -0800 (PST) Date: Tue, 11 Feb 2020 09:48:44 -0500 From: "Michael S. Tsirkin" To: David Hildenbrand Cc: Alexander Duyck , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, mgorman@techsingularity.net, vbabka@suse.cz, yang.zhang.wz@gmail.com, nitesh@redhat.com, konrad.wilk@oracle.com, pagupta@redhat.com, riel@surriel.com, lcapitulino@redhat.com, dave.hansen@intel.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, alexander.h.duyck@linux.intel.com, osalvador@suse.de Subject: Re: [PATCH v16.1 6/9] virtio-balloon: Add support for providing free page reports to host Message-ID: <20200211094357-mutt-send-email-mst@kernel.org> References: <20200122173040.6142.39116.stgit@localhost.localdomain> <20200122174347.6142.92803.stgit@localhost.localdomain> <20200211063441-mutt-send-email-mst@kernel.org> <20200211090052-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2020 at 03:31:18PM +0100, David Hildenbrand wrote: > On 11.02.20 15:07, Michael S. Tsirkin wrote: > > On Tue, Feb 11, 2020 at 01:19:31PM +0100, David Hildenbrand wrote: > >>>> > >>>> Did you see the discussion regarding unifying handling of > >>>> inflate/deflate/free_page_hinting_free_page_reporting, requested by > >>>> Michael? I think free page reporting is special and shall be left alone. > >>> > >>> Not sure what do you mean by "left alone here". Could you clarify? > >> > >> Don't try to unify handling like I proposed below, because it's > >> semantics are special. > >> > >>> > >>>> VIRTIO_BALLOON_F_REPORTING is nothing but a more advanced inflate, right > >>>> (sg, inflate based on size - not "virtio pages")? > >>> > >>> > >>> Not exactly - it's also initiated by guest as opposed to host, and > >>> not guided by the ballon size request set by the host. > >> > >> True, but AFAIKS you could use existing INFLATE/DEFLATE in a similar > >> way. There is no way for the hypervisor to nack a request. The balloon > >> size is not glued to inflate/deflate requests. The guests manually > >> updates it. > > > > Hmm how isn't it? num_pages is the only way to inflate/deflate. > > Usually, guests are nice and respond to num_pages changes in an > appropriate way, except: > - Triggering deflate: Unload the driver. Suspend/hibernate. OOM. > (+ Reboot, although that's special) > - Triggering inflate + deflate: Simple balloon compaction / page > migration. These are all real situations but balloon always has been best effort. > But that's not what I meant. > > "actual" is updated by the guest, not by the host. So the "actual > balloon size" is set by the guest. It's not glued to inflation/deflation > requests. "num_pages" is the host request. Well the expectation is that as long as guest has ample available memory, when num_pages changes then guest starts sending inflate/deflate requests, until actual matches num_pages. If it does not match, and we wait and it still doesn't, then something unusual happened. People do depend on that behaviour. > AFAIKs, the guest could inflate/deflate (esp. temporarily) and > communicate via "actual" the actual balloon size as he sees it. OK so you want hinted but unused pages counted, and reported in "actual"? That's a vmexit before each page use ... > > Spec also says: > > The device is driven either by the receipt of a configuration change notification, or by changing guest memory > > needs, such as performing memory compaction or responding to out of memory conditions. > > > > so ignoring compaction/oom (later is under-specified, not a good example > > to follow) yes inflate/deflate are tied to host specified configuration > Yes, "num_pages" is the host request. But I'd say the statement (esp. > "the device is driven by") in the spec is rather weak. It does not > explicitly state when inflation/deflation is allowed IMHO. Right since it's all best effort anyway. > -- > Thanks, > > David / dhildenb