From patchwork Tue Jun 12 09:38:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 928211 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 414lGx3PYbz9ryk for ; Tue, 12 Jun 2018 19:40:09 +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="hKUTXdiR"; 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 414lGx1vHBzF4D1 for ; Tue, 12 Jun 2018 19:40:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hKUTXdiR"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.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="hKUTXdiR"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 414lDr5HDVzF4C7 for ; Tue, 12 Jun 2018 19:38:19 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id w17-v6so14052820pll.9 for ; Tue, 12 Jun 2018 02:38:19 -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; bh=YL7wyMlZNPtjn9KqAWDR8Rr7REnKuu8XF9GutLFhBDk=; b=hKUTXdiR0VzoPSa5sCLMYu9Llt8f5fs0BhtsPGRHejsBXz3a1bph5eAVz0iJccSv2T XjywtyZ37/pD3YEgbJE/rdC08DeGGgqFXp4bJ+9aq2RmfGug7LyclzWOTyOQJXW8/I8Z SRsNqheHRCMw9QmwE4g4/6+6Zmxp5LgaW26u0n5SuGedORUMl9S+hd6P9nSITklMC5jw BA0MRD8T4Xub17XDAmR2xY/ddyMMGcXgSlogqlvdX3zBE+p2OSYDGgrlt0URlPQ8Ut87 Fafs8PhR4XcALQtTROPEaz0v/F7/SQvBlzMTspOpC46d6A7oPseCZqjdSu146xXFWNfu YvIA== 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; bh=YL7wyMlZNPtjn9KqAWDR8Rr7REnKuu8XF9GutLFhBDk=; b=GpPMFpRHD8NUTeXCz7kSQdzBopT/HJ6AxrTsJVFkA1nCDF95KOWAo63CZFTDok/xLR XwDqVn5mfGPzZKAgGCvqNpAI1nDQr+Qoi38oYKNI+mjzqQnKDZ2012B/ufPaBigAp1Lo W312OsQJhWZDgefPfZLG0EbfArIacfxaqizN+QtZ0f5fq/R6L/R9JXvCfXWjjPJXPaEd wuUXr6TKDZqCEtKvjgVj6pQPUTIy37uZvXJ7/7IOUGyDIsllNEGuw476L0dQOMBWSAxt JbDLTxocDKqsh+flPY3nBhyrMHEO82MkzmB/is7GxsMvGXkzQPrjWD3HVlt7eb6y45nP UnYw== X-Gm-Message-State: APt69E0+yw22NruPHh/i/SYWvKALy0Ic07NmwsO8S4FvEIaE2iF6F8Zw vBqilRzbSh7lI9hLt5lMUfCp5g== X-Google-Smtp-Source: ADUXVKKmg6BiJjmSzUWUd8w9f0fEuFmIOaoxU5ehjzqg8jtu+o3pj+Z83V3pdWPnifOxHG+KYPZo/w== X-Received: by 2002:a17:902:aa03:: with SMTP id be3-v6mr3287205plb.165.1528796297549; Tue, 12 Jun 2018 02:38:17 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id p73-v6sm1380667pfa.142.2018.06.12.02.38.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 02:38:16 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/64s/radix: Fix radix_kvm_prefetch_workaround paca access of not possible CPU Date: Tue, 12 Jun 2018 19:38:08 +1000 Message-Id: <20180612093808.30679-1-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable@kernel.org, Nicholas Piggin , Pridhiviraj Paidipeddi Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If possible CPUs are limited (e.g., by kexec), then the kvm prefetch workaround function can access the paca pointer for a !possible CPU. Fixes: d2e60075a3d44 ("powerpc/64: Use array of paca pointers and allocate pacas individually") Cc: stable@kernel.org Reported-by: Pridhiviraj Paidipeddi Tested-by: Pridhiviraj Paidipeddi Signed-off-by: Nicholas Piggin --- [kdump still seems to have a problem upstream, but this solves one crash] arch/powerpc/mm/tlb-radix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c index 67a6e86d3e7e..06ea845d8033 100644 --- a/arch/powerpc/mm/tlb-radix.c +++ b/arch/powerpc/mm/tlb-radix.c @@ -1043,6 +1043,8 @@ extern void radix_kvm_prefetch_workaround(struct mm_struct *mm) for (; sib <= cpu_last_thread_sibling(cpu) && !flush; sib++) { if (sib == cpu) continue; + if (!cpu_possible(sib)) + continue; if (paca_ptrs[sib]->kvm_hstate.kvm_vcpu) flush = true; }