Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753519AbdHQTDu (ORCPT ); Thu, 17 Aug 2017 15:03:50 -0400 Received: from mail-by2nam01on0041.outbound.protection.outlook.com ([104.47.34.41]:6112 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753326AbdHQTDm (ORCPT ); Thu, 17 Aug 2017 15:03:42 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [RFC Part1 PATCH v3 09/17] resource: Consolidate resource walking code From: Tom Lendacky To: Borislav Petkov , Brijesh Singh Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Tony Luck , Piotr Luc , Fenghua Yu , Lu Baolu , Reza Arbab , David Howells , Matt Fleming , "Kirill A . Shutemov" , Laura Abbott , Ard Biesheuvel , Andrew Morton , Eric Biederman , Benjamin Herrenschmidt , Paul Mackerras , Konrad Rzeszutek Wilk , Jonathan Corbet , Dave Airlie , Kees Cook , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Arnd Bergmann , Tejun Heo , Christoph Lameter References: <20170724190757.11278-1-brijesh.singh@amd.com> <20170724190757.11278-10-brijesh.singh@amd.com> <20170728152342.GB11564@nazgul.tnic> Message-ID: <029b17ab-00c4-c845-d39f-1b3337e296b1@amd.com> Date: Thu, 17 Aug 2017 14:03:30 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0051.namprd12.prod.outlook.com (10.161.151.19) To DM5PR12MB1145.namprd12.prod.outlook.com (10.168.236.140) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47520a63-f41c-4cca-c37a-08d4e5a2aa60 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM5PR12MB1145; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1145;3:tyERDsMghZcVLUrjcI7VgyTNSrUASufk8/opF4b4ff8KpDvpNNgCAuqqsbPwsf+wxAZ1TEldLGIEF3V3hImvxofvzunePsRGNxVOXgyhyZMLJgAaRd+dQsUIAm3Mvj9DbKJvXB4nc8nWZZyqNPMBANwriuEWjTKMLjpWDE4FHbnQt5W1h5b1Jy7Dp4XzpDz+KLFpY+AtBYKSoklE2eQNK8sweeshqxi4KUPM0t7ZGvhUqfaBNnNz1+YHAnT5oFV5;25:00V/LpmV9o+VL07LtFG+nmby51/ySFvbM7AGvqWjx4KsNcmGe7QnUUhfiuVcdyac3FZFZKEh2gjHQgiDo0jmEzJv9g982NuOCWKwZS8fSgfbPAfKW08ogdG/tudZdAioQh+WHSBUMy2QDN9rJAddH7jx8CtdVdcX+YZpvsMRLVZXiUXUIGCMnuZKWlvy3fOvKD5DA2uGSI+HM72L4Clv9Ru3o9QCC9/W3ny6f8RJE4y7YGZbF7tAegv0+aHdJB7Va9kT8dbQLLOUgZnbXie4SUJAVUDuHmeGKXgQ2N/mnK2tV3lo3xsvJT5I1CGMtKQGMzVXIaaQm+KZG/9aX808rg==;31:klv1i0jE11rBtqZjXZSgQWU0OQnRHZ7LtcfWq+mMyDrr/Dc6oDV0Iyae9s/iqACvK1GNtI3LTzMXtcQHUInuYye96q3husy7naQlLpbTSkFrQbsvrgP+41or4ok99Ty/yG01eLPZXmrgPaPcBL3iduRL/9mkH5OGtdQEj4Pao6qmrg29bkBfn3Qs2dlpHTBPfKk4bBnrdT6KyNmXVnhz0uPuJK0qz+hw5j5fRtbXMv8= X-MS-TrafficTypeDiagnostic: DM5PR12MB1145: X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1145;20:aDldt67kcTSRgx/ghMnKBg6L6GQEkXtA9psNsJvqlRVRWKLlLzSGOs/TZgRsHAMGut2K1la2gLh+jCpH6R/mYeMtZkhNaUKblHaJmgK+WZFD31T3gc9M9YXDXGAyBgvdVXxi1nbDYKR3/7Nop+gjKDGMgUMATXQiJt51o+6fnjcOgpiUjSFjucISjzrvQ79JrDB++nMIGcSGFRx+lT1jSj31rrmI42WY5tm76cr2KV2EwXa+mUrWJsNC85td6JzEg9vJTZf5Wm9E5Edk7Y7z6Jk02i9r02oRKbN+V7DXgBQn9WOYdI70ToMEtNJYc0WgjuyAKm7oedpG/R4oN1C2WL30xcSRI/IsEppttkTWXwKzQd8X1MsEL1zod9xiFEuXSwOGp0ggqx0zHfKK3y4OcjBXLvq8t+DTg06zq+TvZdlQJkkStPua/CUu0G+4F1zyl11XqylzpFBLHr8Z+O1JthJEU6wEqTOgjPo0p7ukUdrbXhf/UASnq/4NrUM37kTE;4:rMMxXxjbNtBzON6ACm5ZUcZNmjKvrrLvkZTFmxEfXhCZqssmj4+jbAHFJmPUxoJ9LKZ9jAWlm3gFa77LwJAv6Nt32myttOSfDAC4Drf7D/KR8rMKYq0RlOokszdzsmx4aQPxhsuNnuEd7BdJ7M+P1i1f2EngI+iyf87f7ZxC0xe3VUXEWkxeaEagnXbQP72qjmi49l4ZPK2H/2aM18Pl/7v6aKHk2OSaSdU/CUBPKh7O7tnPkFeG3DpEwVodXeyxTWZLnqB/X6NXZ3HLuEtPFs27DP1b/ufTsM9MItwpvvw= X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR12MB1145;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR12MB1145; X-Forefront-PRVS: 0402872DA1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6009001)(6049001)(39860400002)(377454003)(51444003)(189002)(199003)(51914003)(24454002)(106356001)(6636002)(6666003)(478600001)(53546010)(86362001)(2906002)(23676002)(68736007)(2950100002)(230700001)(4326008)(64126003)(25786009)(3260700006)(97736004)(93886005)(105586002)(53936002)(31696002)(6246003)(65826007)(5660300001)(83506001)(189998001)(54906002)(7350300001)(77096006)(36756003)(6486002)(90366009)(4001350100001)(42186005)(6116002)(229853002)(65956001)(7406005)(7416002)(66066001)(72206003)(65806001)(54356999)(76176999)(305945005)(7736002)(31686004)(47776003)(8676002)(81166006)(81156014)(33646002)(50466002)(50986999)(101416001)(3846002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1145;H:[10.236.64.250];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ1OzIzOmcyb0JwOXNpTHgzZFMxSlMzRE5kSEx1TzYz?= =?utf-8?B?cGtvaWxnU01hRFJzYUoxazVqaklGTWJha0tKMk1iSzNZNmx1RmFxb2JRQXN0?= =?utf-8?B?MEM3MEdYNjVuSEJKdFRrNnRvd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rRCWvijwzBZV4pJ9Ax2j+kcBnHjBPqZR4hBzLXA4o9WwyEp4D2eYZQndzYlLDpeWRNpY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1145;20:e+cdSsOapEvODHMUCyyMIbTHdBIealHN7PnihikiY/zjLJ+ZRrKBYcWjxtH93LQqQ5b4VMAZu0Lqs59RLIz2lujwadSJikW1Pe0yzfe2/++WkhxrY+Fq5qNawOWR7LRLsHNeRIH/CL+ZSS5iDBmXYJ/ZSwvmPlJcqfIzqoAu9O2MpOW0nis7PTLPyJB7Qx2qvK9ejjCbPvSvXyskSE1ncXpR3xH4nN9JOlrZLHDZzwgYJ1uoe6XlkifnFm9eWx3Z X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2017 19:03:36.1700 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1145 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1867 Lines: 60 On 8/17/2017 1:55 PM, Tom Lendacky wrote: > On 7/28/2017 10:23 AM, Borislav Petkov wrote: >> On Mon, Jul 24, 2017 at 02:07:49PM -0500, Brijesh Singh wrote: >>> From: Tom Lendacky >>> >>> The walk_iomem_res_desc(), walk_system_ram_res() and >>> walk_system_ram_range() >>> functions each have much of the same code. Create a new function that >>> consolidates the common code from these functions in one place to reduce >>> the amount of duplicated code. >>> >>> Signed-off-by: Tom Lendacky >>> Signed-off-by: Brijesh Singh >>> --- >>> kernel/resource.c | 53 >>> ++++++++++++++++++++++++++--------------------------- >>> 1 file changed, 26 insertions(+), 27 deletions(-) >>> >>> diff --git a/kernel/resource.c b/kernel/resource.c >>> index 9b5f044..7b20b3e 100644 >>> --- a/kernel/resource.c >>> +++ b/kernel/resource.c >>> @@ -397,9 +397,30 @@ static int find_next_iomem_res(struct resource >>> *res, unsigned long desc, >>> res->start = p->start; >>> if (res->end > p->end) >>> res->end = p->end; >>> + res->desc = p->desc; >>> return 0; >> >> I must be going blind: where are we using that res->desc? > > I think that was left-over from the initial consolidation work I was > doing. I'll remove it. I spoke too soon... I use it in a later patch as part of a callback. But instead of putting it here, I'll add it to the patch that actually needs it. Thanks, Tom > >> >>> +static int __walk_iomem_res_desc(struct resource *res, unsigned long >>> desc, >>> + bool first_level_children_only, >> >> Btw, that variable name is insanely long. > > I know, but I'm maintaining consistency with the name that was already > present vs. changing it. > >> >> The rest looks ok to me, thanks for the cleanup! > > Thanks, > Tom > >>