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=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 02073C55179 for ; Fri, 30 Oct 2020 16:20:08 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 7ED1920719 for ; Fri, 30 Oct 2020 16:20:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ud9l6GZ9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="FSWYLdrs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ED1920719 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BYGdRJdf7as1ot7gNHhnAA7ugyaDlIICrbuvloEPiso=; b=ud9l6GZ9WXPKYaU8O6PAwTOG4 9GuRQ2Pvlk0DnfSolsoUqMZVYB8FyfBj0vqUoxx8lBjd4UVXro5uhZ2Ci3kGoyfeZBR+ULvOKDAls HMbbrP46Ls8mshANj8goiYGtPlONyIkDRwpWjRqad649nrl4jH7RSa93+p36SbY7R5NTmgQlAOnHr jzMNZA056hW2/2D6NLU5yvc+2+tqczFXBva1Gf99Q0sTIK10C45bWCqy88hT82zzJQvTspOWNxPfP 68AecuxtMTiGTSZcWjd6jrrqw2EA7mmJzSonbBUOjjvz6UWCuyy4+4fJvV9nLY9wM1yaDVoYqkGPS yMojNIxGA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYX7p-0001Iy-SS; Fri, 30 Oct 2020 16:19:37 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYX7m-0001Hw-8N for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 16:19:35 +0000 Received: by mail-pf1-x441.google.com with SMTP id y14so5695675pfp.13 for ; Fri, 30 Oct 2020 09:19:33 -0700 (PDT) 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=dpV5+JCLvAj2Fu+RD4QwotunWLsVQxGyCVUUhxPbUwA=; b=FSWYLdrsonhTJtcOLvC+jZU5Gj1TiA4iVM4P+e7yP8fAWGTh8vu2UxOIjyuwkiIOPt a1hTR+idNBMdtcwt9Oj+iztkSkcLlLF8E8p/8YDZpHg7lUTYpb00t4iX9e/noadWmM85 mwRpvEQM6ry77L8lRbp36lbmguKJZoWwPPAzpC2R1QOXjJ1NHx4tcTvC/KAZZUjjYSGc 3dxlAbMdhxw9eFPv/nRYT4EarwQdQXcuTifYWjaeYtMck8M2FlMfI1sIehL+oLRWOqGA 4dteKZ6l+l+OtrqdHCLmSkbSO6HudQ0urxyg3yEScFf4qZdq0tIgnAb4Wwjo1Hng8+Fr rwSw== 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=dpV5+JCLvAj2Fu+RD4QwotunWLsVQxGyCVUUhxPbUwA=; b=jXPnaf5iRqcSVbllfx4Q7qlD6G3OeZQbQmkzcLYKjmkyEfgrPx8xC5KJwaOc7LtWYp MHi00lnm5i+fRd0gxpN/KiVzczP2RxLn3qFbXheQVmI3AFHlrHS6Gwf355rcKs0DaMcJ MS0Z0rn0eFbrUIpn0fl4BmTfXnqKExmzQYmUns42AVz4ovsObP7Du1j1ip6qID5SYlxs RXmjTLbEE04OmzElULoJbOKBixuT0uJgSrf2z8Ye+0RSJcBT8mSu9TZwvULXwEiDej2P D/q9VU7lqoZ/OMeosSZzb6FFCR3fclKix44oJVjqNOk76/rw8iRvifMlff+VbPm5nen0 rcOA== X-Gm-Message-State: AOAM533Bb+zzGUPzBi629ku+DHDBdbx0yHv74ebRBGw0lN3PH+KMcY3i 2ur89pLn7PgmHiFikRKQ9RaIOOkKjH1v0GKAttIyGA== X-Google-Smtp-Source: ABdhPJz/tsifaJhuXgriAGLYjzjyVMccUTostGEnlnHrU3UURZ5aFDAMgOdFOEkCTdURXzV9DDUOO3ioWvzoL92ld40= X-Received: by 2002:a17:90b:807:: with SMTP id bk7mr3737334pjb.166.1604074771799; Fri, 30 Oct 2020 09:19:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Fri, 30 Oct 2020 17:19:20 +0100 Message-ID: Subject: Re: [PATCH RFC v2 09/21] kasan: inline kasan_reset_tag for tag-based modes To: Dmitry Vyukov X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_121934_362387_AD4A84F1 X-CRM114-Status: GOOD ( 26.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marco Elver , Elena Petrova , Linux-MM , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev , LKML , Kostya Serebryany , Alexander Potapenko , Linux ARM , Serban Constantinescu , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Peter Collingbourne , Evgenii Stepanov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 28, 2020 at 12:05 PM Dmitry Vyukov wrote: > > On Thu, Oct 22, 2020 at 3:19 PM Andrey Konovalov wrote: > > > > Using kasan_reset_tag() currently results in a function call. As it's > > called quite often from the allocator code this leads to a noticeable > > slowdown. Move it to include/linux/kasan.h and turn it into a static > > inline function. > > > > Signed-off-by: Andrey Konovalov > > Link: https://linux-review.googlesource.com/id/I4d2061acfe91d480a75df00b07c22d8494ef14b5 > > --- > > include/linux/kasan.h | 5 ++++- > > mm/kasan/hw_tags.c | 5 ----- > > mm/kasan/kasan.h | 6 ++---- > > mm/kasan/sw_tags.c | 5 ----- > > 4 files changed, 6 insertions(+), 15 deletions(-) > > > > diff --git a/include/linux/kasan.h b/include/linux/kasan.h > > index 93d9834b7122..6377d7d3a951 100644 > > --- a/include/linux/kasan.h > > +++ b/include/linux/kasan.h > > @@ -187,7 +187,10 @@ static inline void kasan_record_aux_stack(void *ptr) {} > > > > void __init kasan_init_tags(void); > > > > -void *kasan_reset_tag(const void *addr); > > +static inline void *kasan_reset_tag(const void *addr) > > +{ > > + return (void *)arch_kasan_reset_tag(addr); > > It seems that all implementations already return (void *), so the cast > is not needed. arch_kasan_reset_tag() (->__tag_reset() -> __untagged_addr()) preserves the type of the argument, so the cast is needed. > > > +} > > > > bool kasan_report(unsigned long addr, size_t size, > > bool is_write, unsigned long ip); > > diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c > > index b372421258c8..c3a0e83b5e7a 100644 > > --- a/mm/kasan/hw_tags.c > > +++ b/mm/kasan/hw_tags.c > > @@ -24,11 +24,6 @@ void __init kasan_init_tags(void) > > pr_info("KernelAddressSanitizer initialized\n"); > > } > > > > -void *kasan_reset_tag(const void *addr) > > -{ > > - return reset_tag(addr); > > -} > > - > > void kasan_poison_memory(const void *address, size_t size, u8 value) > > { > > set_mem_tag_range(reset_tag(address), > > diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h > > index 456b264e5124..0ccbb3c4c519 100644 > > --- a/mm/kasan/kasan.h > > +++ b/mm/kasan/kasan.h > > @@ -246,15 +246,13 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag) > > return addr; > > } > > #endif > > -#ifndef arch_kasan_reset_tag > > -#define arch_kasan_reset_tag(addr) ((void *)(addr)) > > -#endif > > #ifndef arch_kasan_get_tag > > #define arch_kasan_get_tag(addr) 0 > > #endif > > > > +/* kasan_reset_tag() defined in include/linux/kasan.h. */ > > +#define reset_tag(addr) ((void *)kasan_reset_tag(addr)) > > The cast is not needed. > > I would also now remove reset_tag entirely by replacing it with > kasan_reset_tag. Having 2 names for the same thing does not add > clarity. Will remove it. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel