From patchwork Wed Jun 5 02:36:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1110284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45JXyL3cMLz9sBb for ; Wed, 5 Jun 2019 12:37:46 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mcKLVm9a"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45JXyK6PgSzDqVZ for ; Wed, 5 Jun 2019 12:37:45 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::444; helo=mail-pf1-x444.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mcKLVm9a"; dkim-atps=neutral Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45JXxb1B55zDqVk for ; Wed, 5 Jun 2019 12:37:07 +1000 (AEST) Received: by mail-pf1-x444.google.com with SMTP id a186so13209037pfa.5 for ; Tue, 04 Jun 2019 19:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0BC3AsuNeqOZZSR6/QItVo1UI9kpmLmM9m6pr4Kc7jY=; b=mcKLVm9aeqcr9VzgjU2aUgTd5vdojz4Au3Fg59hIMAVIixZCElmpEW4zDakji/X2p6 m4mtdmlo1H8zdsgqgRpCmsx2CUcHD25eG5oH9iKSnYB89D4JLI+4PBpdL9ezdjg5f+B0 Vu7tzPt1d2YYSPST2auULWSE7H0DoWewd4JvbXszU8daWz+apvEzmqNj/sjgFwLkDZWD Mc77yIOC0qQK/iTXLjjXLDBGmgbCi1je/eQ6mo6NjlyLZnXELUgBf9tLma06QE8Vzw/5 /gEX6vq/YaTkJF0F9pnfl1pIIuos1bgRs8GmCa/5wm0LkwdNVB8buh4kPaLao9Lalu5W GmFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0BC3AsuNeqOZZSR6/QItVo1UI9kpmLmM9m6pr4Kc7jY=; b=SySL/kXh+vMl4PKYemeVUx1rwy15J5HNp1ZYYp3vG1cdtVazguqjNEbIfL1X8xfyeY AwYpJ8zxwqyVy7y7Ubdxv/wOCdT08QE98kGZeymOiZcFDx+p3hGuq1gj+M+s+QbCKyTl AJOafhBKTnIs7ns4RMvsactxdbVGjQgMNzv92MfKB+yWEwTJoV81HnZXWpy7rXhI+pg0 G/5bvg6BWgmwOtWWzmmsVG03mo2CE2eW8DYKa25giF1kP7/2279DU8v+5RTXQHREBH0T 5DC0eX42i0f//O3808OZOuMiGFTzwFM7Xfdtkrdx1lSZelFAjneXztaYPcUfT7UYYZtu x5eQ== X-Gm-Message-State: APjAAAVkeDHHVhExJTsW++KkUgYXhau4oevhYrJawH2a/Q30/EiWv8b2 OfpzZ/QnpfkYKjgTMDS01dbL0U6Z X-Google-Smtp-Source: APXvYqxefST7oOxa8UR66C6cqJlkUYQEJf1ShGhp0rJzfQI6mi2EkXIf7CHPowZkpG8/TxCHsbY0wQ== X-Received: by 2002:aa7:9e0a:: with SMTP id y10mr41218670pfq.190.1559702224672; Tue, 04 Jun 2019 19:37:04 -0700 (PDT) Received: from bobo.local0.net ([61.68.71.55]) by smtp.gmail.com with ESMTPSA id c9sm9077122pfn.3.2019.06.04.19.37.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 04 Jun 2019 19:37:04 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Wed, 5 Jun 2019 12:36:16 +1000 Message-Id: <20190605023616.26893-4-npiggin@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190605023616.26893-1-npiggin@gmail.com> References: <20190605023616.26893-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [RFC PATCH 3/3] core/vm: try to handle recoverable MCEs by turning off VMM X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This is not foolproof because local mappings and io accessors will not cope with the VMM being switched off, but it may catch some cases. io accessors in particular won't recover properly because they won't switch to use the real-mode cache inhibited instructions after VMM turns off. That could be solved by marking IO accessors as non-recoverable, or providing an exception recovery address which retries. This is mostly just a debugging aid, real MCE recovery for VMM faults would have to flush SLB and translation caches. --- core/exceptions.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/exceptions.c b/core/exceptions.c index 89b4451ab..8dafed676 100644 --- a/core/exceptions.c +++ b/core/exceptions.c @@ -41,6 +41,21 @@ static void dump_regs(struct stack_frame *stack) #define EXCEPTION_MAX_STR 320 +static void print_recoverable_mce_vm(struct stack_frame *stack, uint64_t nip, uint64_t msr) +{ + char buf[EXCEPTION_MAX_STR]; + size_t l; + + l = 0; + l += snprintf(buf + l, EXCEPTION_MAX_STR - l, + "Recoverable MCE with VM on at "REG" ", nip); + l += snprintf_symbol(buf + l, EXCEPTION_MAX_STR - l, nip); + l += snprintf(buf + l, EXCEPTION_MAX_STR - l, " MSR "REG, msr); + prerror("%s\n", buf); + dump_regs(stack); + prerror("Continuing with VM off\n"); +} + void exception_entry(struct stack_frame *stack) { bool fatal = false; @@ -92,6 +107,17 @@ void exception_entry(struct stack_frame *stack) break; case 0x200: + if (this_cpu()->vm_local_map_inuse) + fatal = true; /* local map is non-linear */ + + if (!fatal && (msr & (MSR_IR|MSR_DR))) { + print_recoverable_mce_vm(stack, nip, msr); + /* Turn off VM and try again */ + this_cpu()->vm_setup = false; + stack->srr1 &= ~(MSR_IR|MSR_DR); + goto out; + } + fatal = true; prerror("***********************************************\n"); l += snprintf(buf + l, EXCEPTION_MAX_STR - l,