Received: by 10.192.165.156 with SMTP id m28csp772579imm; Thu, 19 Apr 2018 07:20:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx49F1d/9DtZhsxX1p7CTw26P+3HA6EWDqZoVS3YyLO+Y2bOb5Jr3UueERfsBnob5HEA39xN6 X-Received: by 2002:a17:902:bd4a:: with SMTP id b10-v6mr6398177plx.271.1524147627225; Thu, 19 Apr 2018 07:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524147627; cv=none; d=google.com; s=arc-20160816; b=hh/YJLgUAyA3C2daQm4YAq/PCjZtMlhH7dw58c2oBs/sFkoC6KWSdFa9kaymBYU/m6 byMN1hscgYl2UAJaWD/lNjKMeNgjkuFfuVb9s+i2JBfX9Q72KOSqJwSn+64mb13jx4gu tm81XXTxIjCO8II7e+q250W4rm8f6175lwen/AmvQyAPbSkcm1T8IrUinFNLOwkaXGm7 D/HcdfUoBYkErNQcciX5eFNEARgBf7KsoDTqW23L+g9Pgd2/S9jRSAAmAxVkBN3S0/gh RQIWnktkf2Cuk+jGTmvbJNYUo96QPcmzllz+2VkqIBOWtss4mbWL1bUyWPXkfUwEgsfG 9G6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=LyQEA45SQMJJz4goEY5O3h1bhsNhBA4FOQsrvS+RbOU=; b=QQjoH9pLlc/BbvkYPPIiAbijUKWypc1LjVuGVmzleR4Bmgs1VH1w8M5JIIRApQ1SMV 6QZ7VVo9EtrylGcHmeB2KxURoik0WoUREgmgy9dtyR6UZXEelxc57w9NhZJwSsIHWox1 /kpxJ5GBUHITIOjsc3GhkhNSLNc+jY+0Ag6oqG8DVXAoxcgVsKqbhbnDVP6Jx0qVN08C 6toRMIU3jaTZToQbpLsIXLxt6wxBJ/s5oq7tT0WxLx9eKi9JBbtAt+62NlMyAgZN7wN4 HHILjpAGsjMAubfyVK81bJIyXu9PUNF1Yjm8BskysY6xqZaWxRiwJY77tCY+3uhsScQ6 mOhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HSjz4uNv; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si2941764pgc.265.2018.04.19.07.20.13; Thu, 19 Apr 2018 07:20:27 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=HSjz4uNv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753530AbeDSOTK (ORCPT + 99 others); Thu, 19 Apr 2018 10:19:10 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:41704 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbeDSOTF (ORCPT ); Thu, 19 Apr 2018 10:19:05 -0400 Received: by mail-ot0-f195.google.com with SMTP id m22-v6so5984937otf.8; Thu, 19 Apr 2018 07:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LyQEA45SQMJJz4goEY5O3h1bhsNhBA4FOQsrvS+RbOU=; b=HSjz4uNvrW8S79gzNFss9z/MOOzimxY4y5gGf4OEUDu/0El04AXbesPeQLAYqUHhmr 2S26rWEM3Dq1mgxlNVr0dgy13AqWwgma8eyhqDJbHsXe7Na9P6mETTn7J2jBAIhMd0+d Z664tOSZuRxllqLz2FgK9sxumSWnctQmIZ0DzdDS7PvNPqxqVpJ3l8LOMAYA1uPOUe/7 YwdwAXUQ6Zkvxp+MBodbNIvXb1SJfKpzM/9CPO6fUGUN31879JmSb9pbuy4cf66tM+sN CteP5qFPhusrpwzpMHkLB90wu/IqDvpJ/DnXzOE+siMI09Y5+8QoxvWF9x6cXa6Vu+Kk h0ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LyQEA45SQMJJz4goEY5O3h1bhsNhBA4FOQsrvS+RbOU=; b=GToXKsv1Gxv61jmvcoGqzvLptPXpk0MhdqniFz5XzE4pGDoJOe67mddgzF27KiWMhv jqtX1eDoffmNyHf1IjUjqVfHilMvaLtRmPf5a10UoHLBvmEShSE5hOaPIGwAcsI4YG3C xNLVbm6jRx3WnOjHYit+RsYNX2F1ny/dNeYlOSKpfU8dfDUszKHiUuEqR6O3aXHQU03W HFw7ptnlXrW1jLOOUo+wd7sD6wvun5NCnUg8Y1E/noaYOIp3qeiNoFRS6+2O8Argxxly ygBxZ5aTbUEndlLk9+VH5mj6pgMqhvDVEWtXV6JgA3HB9hIgpSsUORc1va5gaHgvr32p E44w== X-Gm-Message-State: ALQs6tBOK3ifmDG2MAXwXkHpN1Z3L1kSrTKdTM7mGLfgSv9LhIHhHo5J +u33XNr+wAcm/+6e5eyEeo8= X-Received: by 2002:a9d:471a:: with SMTP id a26-v6mr3788182otf.3.1524147544972; Thu, 19 Apr 2018 07:19:04 -0700 (PDT) Received: from nuclearis2_1.gtech (c-98-197-2-30.hsd1.tx.comcast.net. [98.197.2.30]) by smtp.gmail.com with ESMTPSA id u16-v6sm1998124otc.71.2018.04.19.07.19.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 07:19:04 -0700 (PDT) Subject: Re: [RFC PATCH v2 2/4] acpi: apei: Split GHES handlers outside of ghes_do_proc To: Borislav Petkov Cc: linux-acpi@vger.kernel.org, linux-edac@vger.kernel.org, rjw@rjwysocki.net, lenb@kernel.org, tony.luck@intel.com, tbaicar@codeaurora.org, will.deacon@arm.com, james.morse@arm.com, shiju.jose@huawei.com, zjzhang@codeaurora.org, gengdongjiu@huawei.com, linux-kernel@vger.kernel.org, alex_gagniuc@dellteam.com, austin_bolen@dell.com, shyam_iyer@dell.com, devel@acpica.org, mchehab@kernel.org, robert.moore@intel.com, erik.schmauss@intel.com References: <20180416215903.7318-1-mr.nuke.me@gmail.com> <20180416215903.7318-3-mr.nuke.me@gmail.com> <20180418175201.GI4795@pd.tnic> From: "Alex G." Message-ID: <5f26275c-5896-c552-69c4-78e5aaaa6558@gmail.com> Date: Thu, 19 Apr 2018 09:19:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180418175201.GI4795@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/18/2018 12:52 PM, Borislav Petkov wrote: > On Mon, Apr 16, 2018 at 04:59:01PM -0500, Alexandru Gagniuc wrote: >> static void ghes_do_proc(struct ghes *ghes, >> const struct acpi_hest_generic_status *estatus) >> { >> int sev, sec_sev; >> struct acpi_hest_generic_data *gdata; >> + const struct ghes_handler *handler; >> guid_t *sec_type; >> guid_t *fru_id = &NULL_UUID_LE; >> char *fru_text = ""; >> @@ -478,21 +537,10 @@ static void ghes_do_proc(struct ghes *ghes, >> if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) >> fru_text = gdata->fru_text; >> >> - if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { >> - struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata); >> - >> - ghes_edac_report_mem_error(sev, mem_err); >> - >> - arch_apei_report_mem_error(sev, mem_err); >> - ghes_handle_memory_failure(gdata, sev); >> - } >> - else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { >> - ghes_handle_aer(gdata); >> - } >> - else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { >> - struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); >> >> - log_arm_hw_error(err); >> + handler = get_handler(sec_type); > > I don't like this - it was better and more readable before because I can > follow which handler gets called. This change makes is less readable. I agree with the readability argument in the current situation of three handlers. I guess I was thinking ahead and generalizing for an arbitrary number of handlers. On the other side, you lose readability as soon as you get a few more handlers and the function becomes too long. And more importantly, you lose generality: it's not obvious that there's ghes_edac_report_mem_error() which too wide a context. Alex