From mboxrd@z Thu Jan 1 00:00:00 1970 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 0B193C433EF for ; Wed, 15 Jun 2022 15:03:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 875306B0071; Wed, 15 Jun 2022 11:03:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FE2A6B0074; Wed, 15 Jun 2022 11:03:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6786C6B0078; Wed, 15 Jun 2022 11:03:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4EB466B0071 for ; Wed, 15 Jun 2022 11:03:31 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1E18D2114F for ; Wed, 15 Jun 2022 15:03:31 +0000 (UTC) X-FDA: 79580789022.11.460031A Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by imf07.hostedemail.com (Postfix) with ESMTP id 668CC40090 for ; Wed, 15 Jun 2022 15:03:28 +0000 (UTC) Received: by mail-lj1-f181.google.com with SMTP id v8so2552535ljj.8 for ; Wed, 15 Jun 2022 08:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+ZUiH7xUjYjG63QUOQNlcHltjn5KoG/fwg1/o9vk8ew=; b=gmM5PYGKhtiKN/GQbdXDENmVjVligh9DIPiQkG8g9EDUaaAsjjHXs85qVkWWbbgi+B nszrQbXgZRqTwAgSVchLmIr1m8NPS9bv1EsKB+/xz7kNOjgnEcOt3TRr3ysREOzDAeRh bEnhDJ1ESjIS6/vP+qs+svbNVimu+a8X1ilLtTXxAt2+7vonJ+je4mAzwOZe0I5DBayV LaifTuCEM8AsEcmaD0lCMRhjg/POC/AoBLOb1N+6qWIrQl+g55UKPUvA0EgFMmu7yl4S ygVcSI0g+8rzQy4hxPbmjMblUCycMgOwWgGfW7dOebiG5auWZDOu0mAq02s1hm6IBcs3 ipIw== 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=+ZUiH7xUjYjG63QUOQNlcHltjn5KoG/fwg1/o9vk8ew=; b=3oY2cllkYgSzAhvWG5tMwkonAhLDSbiXo1t+K7ewT12j1gqGo61FL8Se/znYG/bG5C aI2sMnO2JGEB7D4ZV4X2DjMmG+7LeW+rfvpeN4C2JOfFX2PVjdugNUA7eMTZ22vZ6woJ paN/CCjv169iCL6lwLqKH+rXLZ1ftUf5vn5HhvwvibzgnTn078XG4y6AI1TWdXrr85VJ MmUDPHALCSiBI2q658qFi7mMvcmrX5Qk/o95SoUS2X9Gc3ZaLH+/E20aQr+KbBiUrVsz tSgEE7Sv0wrB9UgodifGnOaTnjedKIS0HlDYpT87wAfaG8IRQoxVFBJxPSNMB/ATHiST 2qUg== X-Gm-Message-State: AJIora8Y1i/f0dXXADfv7DEZAXqfSYU4RF5h2biYKZJ+J81FemV57Ty2 2m0xu2abH5AMXdFkCwCTyX4EkQ== X-Google-Smtp-Source: AGRyM1uaqkfz9EUjbtFXt3ETq72/vRGrVuX/XEUXnzqPAo5EoI+iVXmhnWWWeIjIy+Gowg+91p1KrQ== X-Received: by 2002:a2e:22c6:0:b0:258:fd28:b253 with SMTP id i189-20020a2e22c6000000b00258fd28b253mr85119lji.418.1655305406697; Wed, 15 Jun 2022 08:03:26 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id k13-20020a2e92cd000000b002556e77236dsm1670253ljh.62.2022.06.15.08.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 08:03:25 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id EFD7A103B9F; Wed, 15 Jun 2022 18:05:34 +0300 (+03) Date: Wed, 15 Jun 2022 18:05:34 +0300 From: "Kirill A. Shutemov" To: Peter Zijlstra Cc: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv7 05/14] x86/boot: Add infrastructure required for unaccepted memory support Message-ID: <20220615150534.ylkref3runa4kmyj@box.shutemov.name> References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> <20220614120231.48165-6-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655305408; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+ZUiH7xUjYjG63QUOQNlcHltjn5KoG/fwg1/o9vk8ew=; b=598ACP0sWYilsfM5RKHv8zbrOgRDq/NwSkVIUk7aAG/M6YwvpWyWu2CrGSsm+yZXgyWmTq IL0UO5IW5cJJR/DkBDgUiH+VMIud9DcRMhGFCDfIL3kSNA/qBwKz2fuRF5NvJAHKZotzj7 jhh2l6EQqjPQzN8gE/1HP6iMwCmvWxE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=gmM5PYGK; dmarc=none; spf=none (imf07.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.208.181) smtp.mailfrom=kirill@shutemov.name ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655305408; a=rsa-sha256; cv=none; b=J25pY61EMdCqeqdAPJRZoPrmWgJ7I2CNvQUYsEeW5qHnmA7N4l/Ktpnim3Tyaa04gGnH57 F30T4nYwA7w3S3uYKi8zHFulWwVOuw3vEo+JJgn4ECMfhPJ0nr+K8+xcf7dD0rTdUo6BFf hMH0iiTbD6S9Q0DEy7hH2mvYu7x6dwY= X-Rspamd-Queue-Id: 668CC40090 X-Rspam-User: X-Stat-Signature: d68s3h8ahiz3hh75yye8e15tmi8eebfr Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=gmM5PYGK; dmarc=none; spf=none (imf07.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.208.181) smtp.mailfrom=kirill@shutemov.name X-Rspamd-Server: rspam04 X-HE-Tag: 1655305408-496433 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: On Wed, Jun 15, 2022 at 12:19:45PM +0200, Peter Zijlstra wrote: > On Tue, Jun 14, 2022 at 03:02:22PM +0300, Kirill A. Shutemov wrote: > > Pull functionality from the main kernel headers and lib/ that is > > required for unaccepted memory support. > > > > This is preparatory patch. The users for the functionality will come in > > following patches. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > arch/x86/boot/bitops.h | 40 ++++++++++++ > > arch/x86/boot/compressed/align.h | 14 +++++ > > arch/x86/boot/compressed/bitmap.c | 43 +++++++++++++ > > arch/x86/boot/compressed/bitmap.h | 49 +++++++++++++++ > > arch/x86/boot/compressed/bits.h | 36 +++++++++++ > > arch/x86/boot/compressed/compiler.h | 9 +++ > > arch/x86/boot/compressed/find.c | 54 ++++++++++++++++ > > arch/x86/boot/compressed/find.h | 80 ++++++++++++++++++++++++ > > arch/x86/boot/compressed/math.h | 37 +++++++++++ > > arch/x86/boot/compressed/minmax.h | 61 ++++++++++++++++++ > > arch/x86/boot/compressed/pgtable_types.h | 25 ++++++++ > > That's quite a lot of duplicated code; is there really no way so share > this? Code duplication also make me uncomfortable. But that what Borislav wanted to see. efi.h in the boot stub which copies bulk of also sets the trend in the direction. Alternative is creating a subset of headers that can be used in both in main kernel and boot stub. It is more complex and doesn't allow for short cuts that can be made on copy if you know the context it is used in. It also sounds painfully similar to uapi/ project. I'm not sure we want to go this path. -- Kirill A. Shutemov