Received: by 10.223.185.116 with SMTP id b49csp717728wrg; Wed, 21 Feb 2018 05:54:34 -0800 (PST) X-Google-Smtp-Source: AH8x226eyebndNggUCr8ovF3I9GZs8SuvI9x+4w3uZ3XHTpBl3DBBjYYljea9VYXVNSGef8jBxBl X-Received: by 2002:a17:902:402:: with SMTP id 2-v6mr3159362ple.353.1519221274866; Wed, 21 Feb 2018 05:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221274; cv=none; d=google.com; s=arc-20160816; b=oLFg85SSJvbpc4VjjaYpUN0jSVZoSeRUk6QI+nata9oa0s11tXR/s6XyfWfvCeJhVU 52oa3hyyXCfAewYCgfxWS/h8CZUtyw9M5j31a5Pw9zbpQ+XzVj7wFDYwpvWfcFpgLynU 9N77UtQn4BZhaE46GBQOkfqx6NM06V8Cypk+PWPKFKRqbNayBJOr/V7rr0XHwV3bA2mE I4Udi6RNAxuiM4pRbc2IxblrxCzWCTddtDgc1myEE8iOgOxO0oNyrjI3mBBcb5F4jTb0 WABR2ldgr9FuBkRPmwbsU6x7iEOPwobpMecFdxHpHsYQupjpyYWgIQCb0Bgkl27dAVSy pjLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RuA5c/LmOFURFp+guAoyZjASXZin3YZa/GPEnNsM0c0=; b=vfXhRqr3ILgWXpl/ol/2/6tXPIWueclpzSDEOS/tQYXEdVJ0kTakWwnklnlL8vc9Lp S+XBgFs+pLfdy/Fg8G1mrw3ND10Il6g3CAcz86hDlzbHWkTgksIzRqhK0d3Jr7dNq/66 gD4uARVpaWgyechevT92J2IyKjDgksZN6cr/6lIcfekfJ0fTqq+mJQGCcAZnExRVf7XM n6coxr2+fluaHNY4NFWuJ+nnq75a15Wk/YRjiCgVIOWa/wjLAwen8o9Ld8gYVIabnep2 jGz7U2UsRFwZfiaVAB9bVX8TFFfLbf3ezGpFa1OllsqGrwD1yyY6gxDPZ0oty3YuMmP8 vwsA== 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 y14si4460263pgs.760.2018.02.21.05.54.20; Wed, 21 Feb 2018 05:54:34 -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; 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 S1754524AbeBUNlH (ORCPT + 99 others); Wed, 21 Feb 2018 08:41:07 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41778 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965195AbeBUNHn (ORCPT ); Wed, 21 Feb 2018 08:07:43 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 65C15FD5; Wed, 21 Feb 2018 13:07:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Sukadev Bhattiprolu , Michael Ellerman Subject: [PATCH 4.15 021/163] powerpc/vas: Dont set uses_vas for kernel windows Date: Wed, 21 Feb 2018 13:47:30 +0100 Message-Id: <20180221124531.343806093@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin commit b00b62898631b756c3e123542bbb0487aa343dd9 upstream. cp_abort is only required for user windows, because kernel context must not be preempted between a copy/paste pair. Without this patch, the init task gets used_vas set when it runs the nx842_powernv_init initcall, which opens windows for kernel usage. used_vas is then never cleared anywhere, so it gets propagated into all other tasks. It's a property of the address space, so it should really be cleared when a new mm is created (or in dup_mmap if the mmaps are marked as VM_DONTCOPY). For now we seem to have no such driver, so leave that for another patch. Fixes: 6c8e6bb2a52d ("powerpc/vas: Add support for user receive window") Cc: stable@vger.kernel.org # v4.15+ Signed-off-by: Nicholas Piggin Reviewed-by: Sukadev Bhattiprolu Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/powernv/vas-window.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/arch/powerpc/platforms/powernv/vas-window.c +++ b/arch/powerpc/platforms/powernv/vas-window.c @@ -1063,16 +1063,16 @@ struct vas_window *vas_tx_win_open(int v rc = PTR_ERR(txwin->paste_kaddr); goto free_window; } + } else { + /* + * A user mapping must ensure that context switch issues + * CP_ABORT for this thread. + */ + rc = set_thread_uses_vas(); + if (rc) + goto free_window; } - /* - * Now that we have a send window, ensure context switch issues - * CP_ABORT for this thread. - */ - rc = -EINVAL; - if (set_thread_uses_vas() < 0) - goto free_window; - set_vinst_win(vinst, txwin); return txwin;