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 D9BEEC433F5 for ; Tue, 8 Feb 2022 08:40:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 630166B0081; Tue, 8 Feb 2022 03:40:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DF146B0083; Tue, 8 Feb 2022 03:40:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CEDA6B0085; Tue, 8 Feb 2022 03:40:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 3E9CD6B0081 for ; Tue, 8 Feb 2022 03:40:38 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0ADA920898 for ; Tue, 8 Feb 2022 08:40:38 +0000 (UTC) X-FDA: 79118966556.01.C79FAA7 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id 8943A14000A for ; Tue, 8 Feb 2022 08:40:37 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A50DDB81885; Tue, 8 Feb 2022 08:40:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3918C340ED; Tue, 8 Feb 2022 08:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644309634; bh=Qiy8w7jKXrvvylMq4I38caclQvB6xxH3iqeR0R/bAX0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RUDaeUvMZt3A1enVwQB7jukcGLYXbBN7fpsIXaAJoaaTwm4vvtBbGFbBTV2uyduuO Vg4bsCVF0JvSBOfiYBx06D/MJk12aowlTO7UeZWZVJtpRBHBnqzMfv/VX3DgDG4BGn HXN5imdeHKqLGeLd4DucRK8RzLhpCpMgWXT3Mmo5tBDs8Y2fQWh8J1DI5HxEqnVl9I gpxI3Tj5NnJmMTJZnmM9y18QKvSCPvlFi575AeIdpIJXzv0HItdCRf6nUqQLSLg+yV PmV8eXKsOesdN/PS3TinZRCuchRF7RsNtlu6hSCiIZ2RKg0k6vSHZoNBP2sfBDNU7g yF3XklW7bPQdg== Date: Tue, 8 Feb 2022 10:40:24 +0200 From: Mike Rapoport To: Kees Cook Cc: Martin Fernandez , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ardb@kernel.org, dvhart@infradead.org, andy@infradead.org, gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, daniel.gutson@eclypsium.com, hughsient@gmail.com, alex.bazhaniuk@eclypsium.com, alison.schofield@intel.com Subject: Re: [PATCH v6 3/6] x86/e820: Refactor range_update and range_remove Message-ID: References: <20220203164328.203629-1-martin.fernandez@eclypsium.com> <20220203164328.203629-4-martin.fernandez@eclypsium.com> <202202071325.F8450B3B2D@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202202071325.F8450B3B2D@keescook> Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RUDaeUvM; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: 7hoayzfcxdym7mumekce19zdhwj7z6n8 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8943A14000A X-Rspam-User: X-HE-Tag: 1644309637-308923 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 Mon, Feb 07, 2022 at 01:45:40PM -0800, Kees Cook wrote: > On Thu, Feb 03, 2022 at 01:43:25PM -0300, Martin Fernandez wrote: > > __e820__range_update and e820__range_remove had a very similar > > implementation with a few lines different from each other, the lines > > that actually perform the modification over the e820_table. The > > similiraties were found in the checks for the different cases on how > > each entry intersects with the given range (if it does at all). These > > checks were very presice and error prone so it was not a good idea to > > have them in both places. > > Yay removing copy/paste code! :) Removing copy/paste is nice but diffstat of arch/x86/kernel/e820.c | 383 ++++++++++++++++++++++++++++++----------- 1 file changed, 283 insertions(+), 100 deletions(-) does not look nice even accounting for lots of comments :( I didn't look closely, but diffstat clues that the refactoring making things much more complex. > > > > I propose a refactor of those functions, given that I need to create a > > similar one for this patchset. > > The diff here is pretty hard (for me) to review; I'll need more time > to check it. What might make review easier (at least for me), is to > incrementally change these routines. i.e. separate patches to: > > - add the new infrastructure > - replace e820__range_remove > - replace __e820__range_update > > If that's not actually useful, no worries. I'll just stare at it a bit > more. :) -- Sincerely yours, Mike.