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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAC85C433F5 for ; Mon, 23 May 2022 15:13:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237624AbiEWPNo (ORCPT ); Mon, 23 May 2022 11:13:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237700AbiEWPNl (ORCPT ); Mon, 23 May 2022 11:13:41 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B5EF5D1BC for ; Mon, 23 May 2022 08:13:27 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E45D139F; Mon, 23 May 2022 08:13:27 -0700 (PDT) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E364E3F73D; Mon, 23 May 2022 08:13:25 -0700 (PDT) Date: Mon, 23 May 2022 16:13:23 +0100 From: Andre Przywara To: Keir Fraser Cc: Will Deacon , kvm@vger.kernel.org, catalin.marinas@arm.com, kernel-team@android.com, Alexandru Elisei Subject: Re: [PATCH kvmtool 0/2] Fixes for virtio_balloon stats printing Message-ID: <20220523161323.0e7df3d5@donnerap.cambridge.arm.com> In-Reply-To: References: <20220520143706.550169-1-keirf@google.com> <165307799681.1660071.7738890533857118660.b4-ty@kernel.org> <20220523154249.2fa6db09@donnerap.cambridge.arm.com> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 23 May 2022 15:06:23 +0000 Keir Fraser wrote: > On Mon, May 23, 2022 at 03:42:49PM +0100, Andre Przywara wrote: > > On Fri, 20 May 2022 21:51:07 +0100 > > Will Deacon wrote: > > > > Hi, > > > > > On Fri, 20 May 2022 14:37:04 +0000, Keir Fraser wrote: > > > > While playing with kvmtool's virtio_balloon device I found a couple of > > > > niggling issues with the printing of memory stats. Please consider > > > > these fairly trivial fixes. > > > > Unfortunately patch 2/2 breaks compilation on userland with older kernel > > headers, like Ubuntu 18.04: > > ... > > CC builtin-stat.o > > builtin-stat.c: In function 'do_memstat': > > builtin-stat.c:86:8: error: 'VIRTIO_BALLOON_S_HTLB_PGALLOC' undeclared (first use in this function); did you mean 'VIRTIO_BALLOON_S_AVAIL'? > > case VIRTIO_BALLOON_S_HTLB_PGALLOC: > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > VIRTIO_BALLOON_S_AVAIL > > (repeated for VIRTIO_BALLOON_S_HTLB_PGFAIL and VIRTIO_BALLOON_S_CACHES). > > > > I don't quite remember what we did here in the past in those cases, > > conditionally redefine the symbols in a local header, or protect the > > new code with an #ifdef? > > For what it's worth, my opinion is that the sensible options are to: > 1. Build against the latest stable, or a specified version of, kernel > headers; or 2. Protect with ifdef'ery until new definitions are > considered "common enough". > > Supporting older headers by grafting or even modifying required newer > definitions on top seems a horrid middle ground, albeit I can > appreciate the pragmatism of it. Fair enough, although I don't think option 1) is really viable for users, as upgrading the distro provided kernel headers is often not an option for the casual user. And even more versed users would probably shy away from staining their /usr/include directory just for kvmtool. Which just leaves option 2? If no one hollers, I will send a patch to that regard. Cheers, Andre > > Regards, > Keir > > > > I would lean towards the former (and hacking this in works), but then we > > would need to redefine VIRTIO_BALLOON_S_NR, to encompass the new symbols, > > which sounds fragile. > > > > Happy to send a patch if we agree on an approach. > > > > Cheers, > > Andre > > > > > > > > > > Keir Fraser (2): > > > > virtio/balloon: Fix a crash when collecting stats > > > > stat: Add descriptions for new virtio_balloon stat types > > > > > > > > [...] > > > > > > Applied to kvmtool (master), thanks! > > > > > > [1/2] virtio/balloon: Fix a crash when collecting stats > > > https://git.kernel.org/will/kvmtool/c/3a13530ae99a > > > [2/2] stat: Add descriptions for new virtio_balloon stat types > > > https://git.kernel.org/will/kvmtool/c/bc77bf49df6e > > > > > > Cheers, > >