Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1267677ybl; Thu, 12 Dec 2019 12:19:56 -0800 (PST) X-Google-Smtp-Source: APXvYqyq1M375PCce8RoN4LC//FF9Bqr2Eg0WNQBYMVe3bB+AdgewzB5wyp74CZZaOVvAt6wAwUO X-Received: by 2002:aca:de0a:: with SMTP id v10mr6031249oig.156.1576181996630; Thu, 12 Dec 2019 12:19:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576181996; cv=none; d=google.com; s=arc-20160816; b=HN9u/FrxrPdRkBW6Ji/ZolD6xKJzMYO1RnMefF47Vykoll2l+B+nNz4vkxflQj3tlA TCEwMWhoa9+FfMTV0tKjVJFZg4SWal/x7l4ShGL0dC/idDOwfRud8ZrUlwY8tXwPXIH5 fTn6nu4L+OyP6STmQ7q/F8f5H+gW1+K+stL/1dhTz89gQElJGELv2Ha4/VFfeJgYlflV dOFA/CZ3g4Qd02RxwxpxAwzSITmaKP0qdlXiDJbHIskN8xGm1Wjv9MLWaq1SIdwzQhL+ 1ZnIh7YmQRVfGxmbmjX8rFe3O4k5WF9GRoFhEOB/qOEQ+wxl3s8v+ea9Iaua4asD8ITH TIkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=j3ZxA3x8+ibwFStiWaC1SmDTUAr00OrM5QZ5N2qHrvA=; b=d+Ao9UUxJ7wFIOkDM+JMgl2fGl6MhS8mDSwvm4rGVdJI96OXuIIiWAyo0hwBO4KBjE 9+XoAdFmlBqMzr9vrFawYkBNH6fEEREuT+hJNuMfcmhE0Tx6h5hSjOHKFe3hKh2xRClK u70YruivNjb3UtnhoEUTu4zAR6dQadD17HmBQmeE2Gm4Gvw/I/Fobk60fIKw2sBYTOZC riltYoFtIz7wnOJJwwAVwwYGRkfzKhlrmES/BI8e4YmbRWW46+pafchErUeeAEy7yIwU 2+3X5A8b09JDEUQXZMmAvnwopK62fs/ZonPJr/nqXKhw9CDlB2wbFsTXet//U8zwC/0A YhLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="Sup/zOKp"; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si3807822oii.169.2019.12.12.12.19.44; Thu, 12 Dec 2019 12:19:56 -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=@alien8.de header.s=dkim header.b="Sup/zOKp"; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730802AbfLLUSx (ORCPT + 99 others); Thu, 12 Dec 2019 15:18:53 -0500 Received: from mail.skyhub.de ([5.9.137.197]:34054 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730707AbfLLUSx (ORCPT ); Thu, 12 Dec 2019 15:18:53 -0500 Received: from zn.tnic (p200300EC2F0A5A00BC9FD9E905C0F14B.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:5a00:bc9f:d9e9:5c0:f14b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 4F4011EC0B73; Thu, 12 Dec 2019 21:18:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1576181932; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=j3ZxA3x8+ibwFStiWaC1SmDTUAr00OrM5QZ5N2qHrvA=; b=Sup/zOKpADPlgSXxDPBHXEJr1RcCm9BaBRSp1ftv7pGNFGf0M2I567m1obCtzHLgjbD2Ji smlhNATlXrBThOys0TFeDGiyki/wZnDYkld284VBXwky0gBMeImvDHqGbOLJu4w4sTMXvX vkcZuBkTXzOa01GdftWZtUwYmMeZdCg= Date: Thu, 12 Dec 2019 21:18:51 +0100 From: Borislav Petkov To: Masayoshi Mizuma Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Baoquan He , Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 1/4] x86/boot: Wrap up the SRAT traversing code into subtable_parse() Message-ID: <20191212201851.GK4991@zn.tnic> References: <20191115144917.28469-1-msys.mizuma@gmail.com> <20191115144917.28469-2-msys.mizuma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191115144917.28469-2-msys.mizuma@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 15, 2019 at 09:49:14AM -0500, Masayoshi Mizuma wrote: > From: Masayoshi Mizuma > > Wrap up the SRAT traversing code into subtable_parse(). Why? > > Reviewed-by: Baoquan He > Signed-off-by: Masayoshi Mizuma > --- > arch/x86/boot/compressed/acpi.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c > index 25019d42ae93..a0f81438a0fd 100644 > --- a/arch/x86/boot/compressed/acpi.c > +++ b/arch/x86/boot/compressed/acpi.c > @@ -362,6 +362,19 @@ static unsigned long get_acpi_srat_table(void) > return 0; > } > > +static void subtable_parse(struct acpi_subtable_header *sub_table, int *num) > +{ > + struct acpi_srat_mem_affinity *ma; > + > + ma = (struct acpi_srat_mem_affinity *)sub_table; > + > + if (!(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && ma->length) { > + immovable_mem[*num].start = ma->base_address; > + immovable_mem[*num].size = ma->length; > + (*num)++; > + } > +} > + > /** > * count_immovable_mem_regions - Parse SRAT and cache the immovable > * memory regions into the immovable_mem array. > @@ -395,14 +408,8 @@ int count_immovable_mem_regions(void) > while (table + sizeof(struct acpi_subtable_header) < table_end) { > sub_table = (struct acpi_subtable_header *)table; > if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) { So this is checking for the table type being something but calling a function which looks generic, at least judging by the name. And that generic function is a function why exactly? It beats me. And the input/output argument @num is actually begging for this to *not* be a function at all. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette