From patchwork Mon Aug 26 20:14:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11115507 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 3A4781399 for ; Mon, 26 Aug 2019 20:14:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 06DF221872 for ; Mon, 26 Aug 2019 20:14:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="QViZPMOC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06DF221872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AAA146B027D; Mon, 26 Aug 2019 16:14:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9974B6B027F; Mon, 26 Aug 2019 16:14:40 -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 885AC6B0280; Mon, 26 Aug 2019 16:14:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0051.hostedemail.com [216.40.44.51]) by kanga.kvack.org (Postfix) with ESMTP id 62F4D6B027D for ; Mon, 26 Aug 2019 16:14:40 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 06DB9824CA3B for ; Mon, 26 Aug 2019 20:14:40 +0000 (UTC) X-FDA: 75865681920.07.hen34_45c9d513cf939 X-Spam-Summary: 2,0,0,b598ffb36879ef4d,d41d8cd98f00b204,daniel.vetter@ffwll.ch,:linux-kernel@vger.kernel.org::dri-devel@lists.freedesktop.org:daniel.vetter@ffwll.ch:jgg@ziepe.ca:akpm@linux-foundation.org:mhocko@suse.com:rientjes@google.com:christian.koenig@amd.com:jglisse@redhat.com:daniel.vetter@intel.com,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3870:3874:4321:5007:6261:6653:7903:10004:10400:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13161:13229:13311:13357:13846:13894:14096:14097:14181:14394:14659:14721:21080:21433:21444:21451:21627:30054:30064,0,RBL:209.85.208.67:@ffwll.ch:.lbl8.mailshell.net-62.8.0.100 66.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:32,LUA_SUMMARY:none X-HE-Tag: hen34_45c9d513cf939 X-Filterd-Recvd-Size: 4857 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Mon, 26 Aug 2019 20:14:39 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id t50so28194644edd.2 for ; Mon, 26 Aug 2019 13:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bUhdeRpbg8gRloy4w33VnXTSeooO5sqpvDT0wx5DMzY=; b=QViZPMOCt4TCBDSlKAVCdrC+U37mohUaGpt7t54fKUAJnII/M30PJe3HVgsMvO32I/ JHmsQisAEo+uwv1GVmUHudMfC1x01ExLcWbO28gdRMZiZ/4jYiOIUrGZ6L9+5vRcVnku F9YxwgBgX7xnEA70Wp+hl/fz9/FJFtPM7Z4dQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bUhdeRpbg8gRloy4w33VnXTSeooO5sqpvDT0wx5DMzY=; b=FNOrI5rxnmPsSQQqYg0mBdy+O3wAwYTGLsr2QjnUwCAK5ZQcZruSbWTbBuf2yQX3gh hXwGGEGZ8GkucKC1uyhcznp2CwWIYO+wd7FGd/QEJVJBW3poyi8SQa1hprdrMJ8qgWor REpr+b/p0gVMtIe69ZduDZW9tyOqHUGJPb9KoVyr4uN0O/omOL/faAVp3/E8FvXK12b0 VuwesZvGQMRkCu+AFMZ/ouBMVZp8Sy7JFSeFIpUd+a92TITMOFN7SHK+YL3vJpbrPpZk 5N+o1R9zuvlDoyQx7CSdou9b/vlcMtmvJ5xF4wJTCE3gBDc+iUpzhTi5snolskwUth2H K+TQ== X-Gm-Message-State: APjAAAXILrIkGwGTq6n7YSIvzzUCcE1gLkSu0yZ5Ih0FJ3nt5aEizp2x qpY2j8Ec1+iXu+znEoY4D07EPA== X-Google-Smtp-Source: APXvYqwQX5rJn4xiT0PzmoOjk8RceDZHB/u+ViHnJA99I4EPasO1Ql6cGV43P/XDRPUyqHKPLLvlzQ== X-Received: by 2002:aa7:c552:: with SMTP id s18mr21104247edr.0.1566850478492; Mon, 26 Aug 2019 13:14:38 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id j25sm3000780ejb.49.2019.08.26.13.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 13:14:37 -0700 (PDT) From: Daniel Vetter To: LKML Cc: Linux MM , DRI Development , Daniel Vetter , Jason Gunthorpe , Andrew Morton , Michal Hocko , David Rientjes , =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?b?SsOp?= =?utf-8?b?csO0bWUgR2xpc3Nl?= , Daniel Vetter Subject: [PATCH 5/5] mm, notifier: annotate with might_sleep() Date: Mon, 26 Aug 2019 22:14:25 +0200 Message-Id: <20190826201425.17547-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190826201425.17547-1-daniel.vetter@ffwll.ch> References: <20190826201425.17547-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: Since mmu notifiers don't exist for more processes, but could block in interesting places, add some annotations. This should help make sure core mm keeps up its end of the mmu notifier contract. The checks here are outside of all notifier checks because of that. They compile away without CONFIG_DEBUG_ATOMIC_SLEEP. Suggested by Jason. Cc: Jason Gunthorpe Cc: Andrew Morton Cc: Michal Hocko Cc: David Rientjes Cc: "Christian König" Cc: Daniel Vetter Cc: "Jérôme Glisse" Cc: linux-mm@kvack.org Signed-off-by: Daniel Vetter --- include/linux/mmu_notifier.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 3f9829a1f32e..8b71813417e7 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -345,6 +345,8 @@ static inline void mmu_notifier_change_pte(struct mm_struct *mm, static inline void mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) { + might_sleep(); + lock_map_acquire(&__mmu_notifier_invalidate_range_start_map); if (mm_has_notifiers(range->mm)) { range->flags |= MMU_NOTIFIER_RANGE_BLOCKABLE; @@ -368,6 +370,9 @@ mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range) static inline void mmu_notifier_invalidate_range_end(struct mmu_notifier_range *range) { + if (mmu_notifier_range_blockable(range)) + might_sleep(); + if (mm_has_notifiers(range->mm)) __mmu_notifier_invalidate_range_end(range, false); }