Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp818834imm; Thu, 31 May 2018 09:55:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTQGF8R2gmhfJ5zk1hSjY51C03b01qnFlwFm+YT9Idh9IG7P8OAHZphmID7tkg5axcVQGT X-Received: by 2002:a17:902:be0b:: with SMTP id r11-v6mr7817860pls.182.1527785723681; Thu, 31 May 2018 09:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527785723; cv=none; d=google.com; s=arc-20160816; b=A5lOPebRGl8mOcahkQdHLWyLj8kJFbCctCv8Bwdudeq3F809CltD0ND+NSvKsXwK/h G1yoSthuOy14lj0twKVsR55VqSoB91jMkE1UIKZSQ6NEVvzF4CjY64L/H+zKxZdTVnNx gSm39VXgO6oyI31GIyBuXBekhN2ESVXZ7eRQnk+wpByuDCYk8aj/YPkQwWuVN8sJY1Lx Y2rxvUJw8e55kdnyllk9cdLjKwrt7AmajS9fAcB+acCF1b2eQVxoybFwo6XRBITNa+0k W/kt/VJ1fzp9ZRuNsH/R/cpsyzsvnFMEXbnmLkxC+74HMo+U40HPvHrBkHZVt3WLA6Vw M1ng== 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:arc-authentication-results; bh=5RVkRrxfcDiKWubsDetRUQMNQaE8sHVwqARyKwRGOGw=; b=UsX+Fu9U/Kk2sbIE4RVQ9tcFfbJzIRe0Ti6CKKo0dmozor6OzEB0w6sgdcvMyO5Yus vkbatg2GlGaC6kxy53qdM9qv6cQQANWgb3/aTmONmOO4kGwmyofzMbs7KiXDz6vwjgYX UZHakETxxrqzQFM9WQJqUW+buEi/TOjyAGOe4jhNGNwQRqtAGcDTfkvavMPrmKffqdBv GUxkiT+JJP9jr3ri9Hs1gZeyTf6XvdQ5JrENSeodR+TlKo05p4stghWgPxwf8FeEPq4e mkjOLfV69EsorKDGbCP4H/c9n1gWbVJaGdV7AXUhk3DtDmtx5pFcfEYasCjLkhfa3LyF enOg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8-v6si29560301pgq.173.2018.05.31.09.55.08; Thu, 31 May 2018 09:55:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755690AbeEaQyn (ORCPT + 99 others); Thu, 31 May 2018 12:54:43 -0400 Received: from foss.arm.com ([217.140.101.70]:43576 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755618AbeEaQyl (ORCPT ); Thu, 31 May 2018 12:54:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D2B841596; Thu, 31 May 2018 09:54:40 -0700 (PDT) Received: from [10.1.207.55] (melchizedek.cambridge.arm.com [10.1.207.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E2243F53D; Thu, 31 May 2018 09:54:38 -0700 (PDT) Subject: Re: [PATCH v1 2/2] arm64: handle NOTIFY_SEI notification by the APEI driver To: Mark Rutland , Dongjiu Geng Cc: catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, tony.luck@intel.com, bp@alien8.de, robert.moore@intel.com, erik.schmauss@intel.com, dave.martin@arm.com, ard.biesheuvel@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org References: <1527770506-8076-1-git-send-email-gengdongjiu@huawei.com> <1527770506-8076-3-git-send-email-gengdongjiu@huawei.com> <20180531110115.uglmicy3nzwfoyx3@lakrids.cambridge.arm.com> From: James Morse Message-ID: <71afa669-e3c5-979e-da5b-1d9cb7056fd6@arm.com> Date: Thu, 31 May 2018 17:51:31 +0100 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: <20180531110115.uglmicy3nzwfoyx3@lakrids.cambridge.arm.com> 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 Hi Mark, Dongjiu Geng, On 31/05/18 12:01, Mark Rutland wrote: > In do_serror() we already handle nmi_{enter,exit}(), so there's no need > for that here. Even better: nmi_enter() has a BUG_ON(in_nmi()). > TBH, I don't understand why do_sea() does that conditionally today. > Unless there's some constraint I'm missing, APEI uses a different fixmap entry and locks when in_nmi(). This was because we may interrupt the irq-masked region in APEI that was using the regular memory. (e.g. the 'polled' notification, or something backed by an interrupt.) But, Borislav has spotted other things in here that are broken[0]. I'm working on rolling all that into 'v5' of the in_nmi() rework stuff. We currently get away with this on arm because 'SEA' is the only NMI-like thing, and it occurs synchronously. The problem cases are all also cases where the kernel text is corrupt, which we can't possibly hope to handle. For NOTIFY_SDEI and NOTIFY_SEI this is the wrong pattern as these are asynchronous. do_serror() has already done most of the work for NOTIFY_SEI, but we need to use the estatus queue in APEI, which is currently x86 only. > I think it would make more > sense to do that regardless of whether the interrupted context had > interrupts enabled. James -- does that make sense to you? > > If you update the prior patch with a stub for !CONFIG_ACPI_APEI_SEI, you > can simplify all of the above additions down to: > > if (!ghes_notify_sei()) > return; > > ... which would look a lot nicer. The code that calls ghes_notify_sei() may need calling by KVM too, but its default action to an 'unclaimed' SError will be different. Because of the race between memory_failure() and return-to-userspace, we may need to kick the irq work queue (if we can), as we return from do_serror(). [1] and [2] provide an example for NOTIFY_SEA. SDEI does this by returning to the kernel through the IRQ handler, (which handles the KVM case too). I think this series is unsafe until we can use the estatus queue in APEI. Its also missing the handling for an SError interrupting a KVM guest. Thanks, James [0] https://www.spinics.net/lists/arm-kernel/msg653332.html [1] https://www.spinics.net/lists/arm-kernel/msg649237.html [2] https://www.spinics.net/lists/arm-kernel/msg649239.html