From patchwork Fri Oct 18 09:42:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11198007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1939913B1 for ; Fri, 18 Oct 2019 09:44:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D062420820 for ; Fri, 18 Oct 2019 09:44:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SgN5nIKf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D062420820 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 436708E0030; Fri, 18 Oct 2019 05:44:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3E75E8E0003; Fri, 18 Oct 2019 05:44:17 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D74D8E0030; Fri, 18 Oct 2019 05:44:17 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id F0C8B8E0003 for ; Fri, 18 Oct 2019 05:44:16 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 9A491A2D0 for ; Fri, 18 Oct 2019 09:44:16 +0000 (UTC) X-FDA: 76056419712.19.cloud05_7c9b55556e005 X-Spam-Summary: 2,0,0,6312909d98e03f17,d41d8cd98f00b204,3b4mpxqykcbw8da56j8gg8d6.4gedafmp-eecn24c.gj8@flex--glider.bounces.google.com,:glider@google.com:vegard.nossum@oracle.com:dvyukov@google.com:,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3152:3352:3865:3867:3868:3870:3871:3872:4250:4321:5007:6120:6261:6653:7901:9969:10004:10400:11026:11232:11658:11914:12043:12114:12296:12297:12438:12555:12895:13069:13311:13357:13846:14181:14394:14659:14721:21080:21365:21444:21451:21627:30054:30064,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: cloud05_7c9b55556e005 X-Filterd-Recvd-Size: 4101 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Oct 2019 09:44:16 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id v7so415539wrf.4 for ; Fri, 18 Oct 2019 02:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=lKHqfOkwipsGh4+LNCETFHU5JmZXDTfRhV3V1uQ64Eg=; b=SgN5nIKfCdOq4l9YeBaMP2o1a0uvq1c1bmhVrXnBQUMyD52G8q3k+alvhZi+ukHMsh kA9p78D0WXpzunvDRoNfJhn5pRjnhkH3XHq91MpZUiU60bxgcwrvr2bb/hZv2n30YCzT PmUV7FpwZLbkJ3aT0n3f21Pnd6Zrby0eWoYGTWnSzyvUU28LhFl2vWxayFKBGJhcTloO oMocRbVLh1jSKJ/ledg3RrjRTGKdWL4+YGoCTMYoLNO5/Ai1q9niWNrkYzYKZ4LDY9Q8 VyCkBq3PPaW1q2UQ6FUJpHi0kG7i8UtG+5WoEPbPYmslGW58n9bwtHs9RlHo+/Hj9kIz gX3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lKHqfOkwipsGh4+LNCETFHU5JmZXDTfRhV3V1uQ64Eg=; b=VJk+nbtId17NtzO5keURm+epRRypOl9kgm+iIa6fd57QSopawe0+Se83r39qQqmbKg R/aB13UQUnEh1Z3gkd+jtcjagTWPXwUQEQz+w/pr1R0GSuF6kqelGEh1vACb1rSZ4ZVo 4SYe6N2gbBZEi6hxl3eerVTPaQZiALvcXBtvXMK3BW+++/5HEgyFQaGq7pgoAHz/nVXW IKFhdkcJhO2P+SKlwtDNJYVYZx5GiurkI99qzHafKlSWqO5s3lGkwjZi4mCSUhukPWT3 brtIf3QN0DMU1Q1oEXxNyeDQqa6jPb3nnsP5m/9PxNTFYRLczEzQByVRpxoMy9CBBfNX 1kVg== X-Gm-Message-State: APjAAAWWUKykVxGN2yWj7cVn/M4X865ouyuY6Nz0/mjmmV3Dl/PEWn6g BLI/S66hKoLcnQLFPi0NvKYl9b/0L+8= X-Google-Smtp-Source: APXvYqxLWK60QBB3J4J+3pyoYlKx2r+N57kwxpdy6Xrlh4Da+yQtlaBaJuhTdL6A7bjD/lAmOgP1rQzSEmA= X-Received: by 2002:adf:fe12:: with SMTP id n18mr7384656wrr.114.1571391855100; Fri, 18 Oct 2019 02:44:15 -0700 (PDT) Date: Fri, 18 Oct 2019 11:42:59 +0200 In-Reply-To: <20191018094304.37056-1-glider@google.com> Message-Id: <20191018094304.37056-22-glider@google.com> Mime-Version: 1.0 References: <20191018094304.37056-1-glider@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog Subject: [PATCH RFC v1 21/26] kmsan: unpoison |tlb| in arch_tlb_gather_mmu() From: glider@google.com To: Alexander Potapenko Cc: Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org 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: This is a hack to reduce stackdepot pressure. Signed-off-by: Alexander Potapenko To: Alexander Potapenko Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: linux-mm@kvack.org --- Change-Id: I22a201e7e4f67ed74f8129072f12e5351b26103a --- mm/mmu_gather.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c index 7d70e5c78f97..8c5ea2d2e7d5 100644 --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -206,6 +207,15 @@ void tlb_flush_mmu(struct mmu_gather *tlb) void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) { + /* + * TODO(glider): struct mmu_gather contains 7 1-bit fields packed into a + * 32-bit unsigned int value. The remaining 25 bits remain uninitialized + * and are never used, but KMSAN updates the origin for them in + * zap_pXX_range() in mm/memory.c, thus creating very long origin + * chains. This is technically correct, but consumes too much memory. + * Unpoisoning the whole structure will prevent creating such chains. + */ + kmsan_unpoison_shadow(tlb, sizeof(*tlb)); tlb->mm = mm; /* Is it from 0 to ~0? */