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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham 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 BC603C433DB for ; Fri, 5 Feb 2021 16:25:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 350A764DE7 for ; Fri, 5 Feb 2021 16:25:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 350A764DE7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 95B8F6B0074; Fri, 5 Feb 2021 11:25:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 90D1A6B0075; Fri, 5 Feb 2021 11:25:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FAEE6B0078; Fri, 5 Feb 2021 11:25:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 686156B0074 for ; Fri, 5 Feb 2021 11:25:57 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2C8973633 for ; Fri, 5 Feb 2021 16:25:57 +0000 (UTC) X-FDA: 77784740754.11.crib04_0b18043275e6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 055A6180F8B81 for ; Fri, 5 Feb 2021 16:25:56 +0000 (UTC) X-HE-Tag: crib04_0b18043275e6 X-Filterd-Recvd-Size: 5935 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 16:25:56 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id y10so3815328plk.7 for ; Fri, 05 Feb 2021 08:25:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=YWfA2TQ5ApvZiaB/IqgvOHh0zr5cPm+JHUeKZ3MWatPWqRn+mvCJRLw/TwPHlOjRX3 xSzjR3V9y59pebgurUiBcvvHg+NeXKpZNzzyfxxhKXfVgRx86huXB3XiDaEup1uA3iZu 58WHlIewB/n6yqYVlpdN2029/6Xn3wg2TRyryIQtMn0Jsn+i+ZMW8jyL6K71IhSHNL33 E1X/C2e96YJz8ZE451WxgNnwUhqWRee0PR7JOK+kUsqhvgZTq/Mh4RPW3a+Ch+rZ9rYJ ykElq77xB8X64yHy+M0EZZCevdU23gKPsL+WVLfFgJKRcLus7h61IuWtG43Pf0p+Tksc 1+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=ZpSfVf1lLHw4W+0bbPpYmfF9e5Gmf6J3HzOAZELZcVu81KssDmz7MeLN9oj+ArK1mB tM/lUNCiIDm1zV50AgiuzykBj46l8ZYrPfRf183zZbS5vgH99Q+0EQC04Js/IHTwb9b9 Rr7gWT3pSHXjrpeaiP5ilnbViOLPO5GQeZjHhOEkAorkTo1ucSZkJtJTEpGGCW5gGoqQ SiI1DOfZlz4pAhXz/9xwJmiO169pWr5yabwQaAuvz9weeylWdKZnAaoEhl1NFZ3uYinr Q/1Rps5jyuOOCaUBKdvVChneMCetjkcMjjoUyWxm7MhcHdFqbsmLA1sNBVsNe4Ga88XM rVMQ== X-Gm-Message-State: AOAM533hC5clkl6NonuB8fyMoBj5C++ouSv05LaA6ZZb5G7htFqLymno gM1lMz349/1yuXuZAvyUNhIpQKM7W+A2CaHa8Fq1DQ== X-Google-Smtp-Source: ABdhPJz7hg3W9UVrqwUtxXCMXQuIfjDWNNH7DXXlqilvLV51Hybl4F2VuwOFjYZCYn1biMA69T6PJSx+PVqU/vuc6IU= X-Received: by 2002:a17:90b:350b:: with SMTP id ls11mr4812469pjb.166.1612542355340; Fri, 05 Feb 2021 08:25:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Fri, 5 Feb 2021 17:25:44 +0100 Message-ID: Subject: Re: [PATCH v2 00/12] kasan: optimizations and fixes for HW_TAGS To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Will Deacon , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Feb 5, 2021 at 4:39 PM Andrey Konovalov wrote: > > This patchset goes on top of: > > 1. Vincenzo's async support patches [1], and > 2. "kasan: untag addresses for KFENCE" fix [2] (already in mm). > > [1] https://lore.kernel.org/linux-arm-kernel/20210130165225.54047-1-vincenzo.frascino@arm.com/ > [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=akpm&id=dec4728fab910da0c86cf9a97e980f4244ebae9f > > This patchset makes the HW_TAGS mode more efficient, mostly by reworking > poisoning approaches and simplifying/inlining some internal helpers. > > With this change, the overhead of HW_TAGS annotations excluding setting > and checking memory tags is ~3%. The performance impact caused by tags > will be unknown until we have hardware that supports MTE. > > As a side-effect, this patchset speeds up generic KASAN by ~15%. Forgot to include changes v1->v2: - Use EXPORT_SYMBOL_GPL() for arm64 symbols. - Rename kmalloc bool flag argument to is_kmalloc. - Make empty mte_set_mem_tag_range() return void. - Fix build warning in 32-bit systems by using unsigned long instead of u64 in WARN_ON() checks. - Minor changes in comments and commit descriptions. - Use kfence_ksize() before __ksize() to avoid crashes with KFENCE. - Use inline instead of __always_inline. > > Andrey Konovalov (12): > kasan, mm: don't save alloc stacks twice > kasan, mm: optimize kmalloc poisoning > kasan: optimize large kmalloc poisoning > kasan: clean up setting free info in kasan_slab_free > kasan: unify large kfree checks > kasan: rework krealloc tests > kasan, mm: fail krealloc on freed objects > kasan, mm: optimize krealloc poisoning > kasan: ensure poisoning size alignment > arm64: kasan: simplify and inline MTE functions > kasan: inline HW_TAGS helper functions > arm64: kasan: export MTE symbols for KASAN tests > > arch/arm64/include/asm/cache.h | 1 - > arch/arm64/include/asm/kasan.h | 1 + > arch/arm64/include/asm/mte-def.h | 2 + > arch/arm64/include/asm/mte-kasan.h | 65 ++++++++-- > arch/arm64/include/asm/mte.h | 2 - > arch/arm64/kernel/mte.c | 48 +------- > arch/arm64/lib/mte.S | 16 --- > include/linux/kasan.h | 25 ++-- > lib/test_kasan.c | 111 +++++++++++++++-- > mm/kasan/common.c | 187 ++++++++++++++++++++--------- > mm/kasan/kasan.h | 72 +++++++++-- > mm/kasan/shadow.c | 53 ++++---- > mm/slab_common.c | 18 ++- > mm/slub.c | 3 +- > 14 files changed, 418 insertions(+), 186 deletions(-) > > -- > 2.30.0.365.g02bc693789-goog >