From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11F29C433E2 for ; Tue, 15 Sep 2020 07:26:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0F4B2080C for ; Tue, 15 Sep 2020 07:26:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Gm/q+1/L"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MuKXrmlh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726134AbgIOHZw (ORCPT ); Tue, 15 Sep 2020 03:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726213AbgIOHY4 (ORCPT ); Tue, 15 Sep 2020 03:24:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D540C061788; Tue, 15 Sep 2020 00:24:47 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600154684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BBI2zNFANGXkWYE4Qif9cyGi7S1uMUtiVcafI/NKee0=; b=Gm/q+1/LmIgUKVhaBfxbtH41gZrDIBH8IS1H4zgztvnc5soB5Q5S9GFvwqD6AMThAJg7Eu ICkbMzhHS8winOchbTgcb1qlmuZD7JVBas9osW7dkmUkrA19fW7G1Z84ERIdydT1XwABtV b3YTiGY6/hGrgHGqtbAMSZ6WiChgMDc5V88LWXOoC6nxdSrZr6KYOF2hnpnoShLvzpGVZ4 qfLpRcJbnCwBly7jDRkK74aDmCV0ZOOHMRl3SoG6khP3VCoWYVF9b0W5VeuBj1d+MuAvxt 6cYp5N7yEfk2d6IXe87eOWbHI/ZdUwoUn1UDCyhqgpi5uCSq9M8lJDN8rwQv1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600154684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BBI2zNFANGXkWYE4Qif9cyGi7S1uMUtiVcafI/NKee0=; b=MuKXrmlhK1T+BH9XqoTgVQdGqBSQY5pVtsbiA531viHwxJXMJTBsBB/Iwr2EqMuOspN/XP 6hM/wG9/ctqUbmCQ== To: Linus Torvalds , Herbert Xu Cc: Ard Biesheuvel , LKML , linux-arch , Sebastian Andrzej Siewior , Valentin Schneider , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um , Brian Cain , linux-hexagon@vger.kernel.org, Geert Uytterhoeven , linux-m68k , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Andrew Morton , Linux-MM , Ingo Molnar , Russell King , Linux ARM , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx , dri-devel , "Paul E. McKenney" , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Shuah Khan , rcu@vger.kernel.org Subject: Re: [patch 00/13] preempt: Make preempt count unconditional In-Reply-To: References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> <20200915062253.GA26275@gondor.apana.org.au> Date: Tue, 15 Sep 2020 09:24:44 +0200 Message-ID: <87een35woz.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14 2020 at 23:39, Linus Torvalds wrote: > On Mon, Sep 14, 2020 at 11:24 PM Herbert Xu wrote: >> > But another reason I tried to avoid kmap_atomic() is that it disables >> > preemption unconditionally, even on 64-bit architectures where HIGHMEM >> > is irrelevant. So using kmap_atomic() here means that the bulk of >> > WireGuard packet encryption runs with preemption disabled, essentially >> > for legacy reasons. >> >> Agreed. We should definitely fix that. > > Well, honestly, one big reason for that is debugging. > > The *semantics* of the kmap_atomic() is in the name - you can't sleep > in between it and the kunmap_atomic(). > > On any sane architecture, kmap_atomic() ends up being a no-op from an > implementation standpoint, and sleeping would work just fine. > > But we very much want to make sure that people don't then write code > that doesn't work on the bad old 32-bit machines where it really needs > that sequence to be safe from preemption. Alternatively we just make highmem a bit more expensive by making these maps preemptible. RT is doing this for a long time and it's not that horrible. The approach is to keep track about the number of active maps in a task and on an eventual context switch save them away in the task struct and restore them when the task is scheduled back in. Thanks, tglx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EBBCC43461 for ; Tue, 15 Sep 2020 07:24:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 079E221D1B for ; Tue, 15 Sep 2020 07:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Gm/q+1/L"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MuKXrmlh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 079E221D1B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 497B56E030; Tue, 15 Sep 2020 07:24:49 +0000 (UTC) Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 55B606E030; Tue, 15 Sep 2020 07:24:47 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600154684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BBI2zNFANGXkWYE4Qif9cyGi7S1uMUtiVcafI/NKee0=; b=Gm/q+1/LmIgUKVhaBfxbtH41gZrDIBH8IS1H4zgztvnc5soB5Q5S9GFvwqD6AMThAJg7Eu ICkbMzhHS8winOchbTgcb1qlmuZD7JVBas9osW7dkmUkrA19fW7G1Z84ERIdydT1XwABtV b3YTiGY6/hGrgHGqtbAMSZ6WiChgMDc5V88LWXOoC6nxdSrZr6KYOF2hnpnoShLvzpGVZ4 qfLpRcJbnCwBly7jDRkK74aDmCV0ZOOHMRl3SoG6khP3VCoWYVF9b0W5VeuBj1d+MuAvxt 6cYp5N7yEfk2d6IXe87eOWbHI/ZdUwoUn1UDCyhqgpi5uCSq9M8lJDN8rwQv1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600154684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BBI2zNFANGXkWYE4Qif9cyGi7S1uMUtiVcafI/NKee0=; b=MuKXrmlhK1T+BH9XqoTgVQdGqBSQY5pVtsbiA531viHwxJXMJTBsBB/Iwr2EqMuOspN/XP 6hM/wG9/ctqUbmCQ== To: Linus Torvalds , Herbert Xu In-Reply-To: References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> <20200915062253.GA26275@gondor.apana.org.au> Date: Tue, 15 Sep 2020 09:24:44 +0200 Message-ID: <87een35woz.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Subject: Re: [Intel-gfx] [patch 00/13] preempt: Make preempt count unconditional X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , Lai Jiangshan , dri-devel , Ben Segall , Linux-MM , linux-hexagon@vger.kernel.org, Will Deacon , Ingo Molnar , Anton Ivanov , linux-arch , Brian Cain , Richard Weinberger , Russell King , Ard Biesheuvel , David Airlie , Ingo Molnar , Geert Uytterhoeven , Mel Gorman , intel-gfx , Matt Turner , Valentin Schneider , linux-xtensa@linux-xtensa.org, Shuah Khan , "Paul E. McKenney" , Jeff Dike , linux-um , Josh Triplett , Steven Rostedt , rcu@vger.kernel.org, linux-m68k , Ivan Kokshaysky , Dietmar Eggemann , Linux ARM , Richard Henderson , Chris Zankel , Max Filippov , LKML , alpha , Mathieu Desnoyers , Andrew Morton , Daniel Bristot de Oliveira Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, Sep 14 2020 at 23:39, Linus Torvalds wrote: > On Mon, Sep 14, 2020 at 11:24 PM Herbert Xu wrote: >> > But another reason I tried to avoid kmap_atomic() is that it disables >> > preemption unconditionally, even on 64-bit architectures where HIGHMEM >> > is irrelevant. So using kmap_atomic() here means that the bulk of >> > WireGuard packet encryption runs with preemption disabled, essentially >> > for legacy reasons. >> >> Agreed. We should definitely fix that. > > Well, honestly, one big reason for that is debugging. > > The *semantics* of the kmap_atomic() is in the name - you can't sleep > in between it and the kunmap_atomic(). > > On any sane architecture, kmap_atomic() ends up being a no-op from an > implementation standpoint, and sleeping would work just fine. > > But we very much want to make sure that people don't then write code > that doesn't work on the bad old 32-bit machines where it really needs > that sequence to be safe from preemption. Alternatively we just make highmem a bit more expensive by making these maps preemptible. RT is doing this for a long time and it's not that horrible. The approach is to keep track about the number of active maps in a task and on an eventual context switch save them away in the task struct and restore them when the task is scheduled back in. Thanks, tglx _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: Re: [patch 00/13] preempt: Make preempt count unconditional Date: Tue, 15 Sep 2020 09:24:44 +0200 Message-ID: <87een35woz.fsf@nanos.tec.linutronix.de> References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> <20200915062253.GA26275@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600154684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BBI2zNFANGXkWYE4Qif9cyGi7S1uMUtiVcafI/NKee0=; b=Gm/q+1/LmIgUKVhaBfxbtH41gZrDIBH8IS1H4zgztvnc5soB5Q5S9GFvwqD6AMThAJg7Eu ICkbMzhHS8winOchbTgcb1qlmuZD7JVBas9osW7dkmUkrA19fW7G1Z84ERIdydT1XwABtV b3YTiGY6/hGrgHGqtbAMSZ6WiChgMDc5V88LWXOoC6nxdSrZr6KYOF2hnpnoShLvzpGVZ4 qfLpRcJbnCwBly7jDRkK74aDmCV0ZOOHMRl3SoG6khP3VCoWYVF9b0W5VeuBj1d+MuAvxt 6cYp5N7yEfk2d6IXe87eOWbHI/ZdUwoUn1UDCyhqgpi5uCSq9M8lJDN8rwQv1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600154684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BBI2zNFANGXkWYE4Qif9cyGi7S1uMUtiVcafI/NKee0=; b=MuKXrmlhK1T+BH9XqoTgVQdGqBSQY5pVtsbiA531viHwxJXMJTBsBB/Iwr2EqMuOspN/XP 6hM/wG9/ctqUbmCQ== In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Linus Torvalds , Herbert Xu Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , Lai Jiangshan , dri-devel , Ben Segall , Linux-MM , linux-hexagon@vger.kernel.org, Will Deacon , Ingo Molnar , Anton Ivanov , linux-arch , Brian Cain , Richard Weinberger , Russell King , Ard Biesheuvel , David Airlie , Ingo Molnar , Geert Uytterhoeven , Mel Gorman , intel-gfx , Matt Turner , Valentin Schneider , linux-xtensa@li On Mon, Sep 14 2020 at 23:39, Linus Torvalds wrote: > On Mon, Sep 14, 2020 at 11:24 PM Herbert Xu wrote: >> > But another reason I tried to avoid kmap_atomic() is that it disables >> > preemption unconditionally, even on 64-bit architectures where HIGHMEM >> > is irrelevant. So using kmap_atomic() here means that the bulk of >> > WireGuard packet encryption runs with preemption disabled, essentially >> > for legacy reasons. >> >> Agreed. We should definitely fix that. > > Well, honestly, one big reason for that is debugging. > > The *semantics* of the kmap_atomic() is in the name - you can't sleep > in between it and the kunmap_atomic(). > > On any sane architecture, kmap_atomic() ends up being a no-op from an > implementation standpoint, and sleeping would work just fine. > > But we very much want to make sure that people don't then write code > that doesn't work on the bad old 32-bit machines where it really needs > that sequence to be safe from preemption. Alternatively we just make highmem a bit more expensive by making these maps preemptible. RT is doing this for a long time and it's not that horrible. The approach is to keep track about the number of active maps in a task and on an eventual context switch save them away in the task struct and restore them when the task is scheduled back in. Thanks, tglx