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 3D0C8C43461 for ; Tue, 15 Sep 2020 07:25:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE6A320897 for ; Tue, 15 Sep 2020 07:24:59 +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 S1726212AbgIOHY4 (ORCPT ); Tue, 15 Sep 2020 03:24:56 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40012 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbgIOHYt (ORCPT ); Tue, 15 Sep 2020 03:24:49 -0400 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-m68k-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-m68k@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