Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3779445rdh; Tue, 28 Nov 2023 03:50:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUGV0umy11aBjZdHpUoHi2xLPU2awfKXiPQ6cksbx4wZG4l9tE8vKDYj07aBrcoEuCTSky X-Received: by 2002:a05:6a20:d396:b0:18b:d31f:7d25 with SMTP id iq22-20020a056a20d39600b0018bd31f7d25mr17987729pzb.38.1701172233578; Tue, 28 Nov 2023 03:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701172233; cv=none; d=google.com; s=arc-20160816; b=Ec3extp/ogWUHQSZrW83LSAPNIbEJC/d+fWf5aJ2bI5t32Yx/C+MJHvS+Rl15d+rnM isKnioeRReZv6NpKZyO3NJl41b5D37gNhLGqfTcpLfY5/56TFoDq2wnlPymRsqIDkWTT w9J9Keen8ngdDyG3E/fV8VhxoIrLRbFZYuAYeQqUeGJquTZkEZCn3fDWQjjuU3ZZmoTZ Qm4tTlJj6yUapACmf/cXwG/E8GVC+MY68IOg128VmKAVLzc5HYnCMbuXJsXULRhHW3HP AzWqAsKkCgg8rPIZHV3YFpS7+N+eZRkLz80Ir6BWBVbOKwIippiY9RPq1ORnKcCpEXTy jH2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OCv5jOPu04qFPi6ssiG4av97RLxhHF1iTMxErUPuhxM=; fh=raXVug2hDONLjEa9/c/ssRQsZEjqgy5UiwUGPRsvaYQ=; b=p0nsbolCMkm8Q+0MBNJsd57JjxnO5Gu5UaHvlcsx1+aY5mrmZ21YKeTVgt32UMj06i xm0UftUVk38QDsc9t3L5Il3vE+wDb7HQhBDq0RDvIf5eifUlzTHZtfnhkQwK1AJZkGmn TRfKDobDpepQAToLRj5eWSOBXhzL+GMc2kmY3OilbWIvxyATrXioYIvIf+KH27/4I2Au X35WNRJLYsPXSdA63cY1DNPxdjY1dtFrPhgDOTCwanknp+1bvnh2Imo2pFCd+uz0dhYD OrlcZlsbYT8KpQ9YzkIw2ir/jf1AgDXWfxeCKop2scydKPipc1E7e6JykjCcncRtEWjH qI2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OjVTNoCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id pi2-20020a17090b1e4200b0027d032092d7si6314164pjb.184.2023.11.28.03.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 03:50:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OjVTNoCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 650C28075DF4; Tue, 28 Nov 2023 03:50:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344593AbjK1LuK (ORCPT + 99 others); Tue, 28 Nov 2023 06:50:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344563AbjK1LuI (ORCPT ); Tue, 28 Nov 2023 06:50:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D18BED6D for ; Tue, 28 Nov 2023 03:50:14 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78109C433CC; Tue, 28 Nov 2023 11:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701172214; bh=OCv5jOPu04qFPi6ssiG4av97RLxhHF1iTMxErUPuhxM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OjVTNoCngj8vhKQa4NLxoGYZGPzhnXiWZTtymJszXRp9aE5OHmasJdxQxtWYTb1lT x+1ii7lVkfaehoU9AwY17drmJlHGDUVjY7gb2ulMt29SnG31aIAXjY37IRjiHqrjRT 3IyWZ8kl4uz0D3//4gXLGxipDqQnpzx9x+U9UdxJYrg2UWwtb4/ihKunSdFRHYuX+H D+x+WM+Y3GycueXKYJcj+GJCE306wYDXHxsJla04bHbSsmI8/Hi3Dnwyv/uDMfvytG 1/2/evih98QpUNbii8Xkms+PQRMMYyODIGLBkHgdLmBJvtbqfJl+XYsK2hGEgkS/Gz iCU0/MZpgLXFA== Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2c9b8363683so3623011fa.3; Tue, 28 Nov 2023 03:50:14 -0800 (PST) X-Gm-Message-State: AOJu0Yx5jqUbtgYW/G3SpJbJnB6Qtq2V+fGwottcRm1Yo2vFFcLjcjRQ 2LEuHEgv7AKMUL6xWVigi1VERosYiMaVBvRxIrM= X-Received: by 2002:a2e:7a0e:0:b0:2c9:b8e0:6e4c with SMTP id v14-20020a2e7a0e000000b002c9b8e06e4cmr434921ljc.49.1701172212628; Tue, 28 Nov 2023 03:50:12 -0800 (PST) MIME-Version: 1.0 References: <20231103151354.110636-1-michael.roth@amd.com> <30ff0335-3d9c-7d54-85d0-5898320f4e1f@suse.cz> <9be0159e-1762-6c07-e6eb-a86f1c780118@suse.cz> In-Reply-To: <9be0159e-1762-6c07-e6eb-a86f1c780118@suse.cz> From: Ard Biesheuvel Date: Tue, 28 Nov 2023 12:50:01 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] efi/unaccepted: Fix off-by-one when checking for overlapping ranges To: Vlastimil Babka Cc: Michael Roth , linux-efi@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" , Nikolay Borisov , stable@kernel.org, Tom Lendacky , Paolo Bonzini Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 28 Nov 2023 03:50:30 -0800 (PST) On Tue, 28 Nov 2023 at 12:25, Vlastimil Babka wrote: > > On 11/8/23 12:21, Ard Biesheuvel wrote: > > On Fri, 3 Nov 2023 at 16:30, Vlastimil Babka wrote: > >> > >> On 11/3/23 16:13, Michael Roth wrote: > >> > When a task needs to accept memory it will scan the accepting_list > >> > to see if any ranges already being processed by other tasks overlap > >> > with its range. Due to an off-by-one in the range comparisons, a task > >> > might falsely determine that an overlapping range is being accepted, > >> > leading to an unnecessary delay before it begins processing the range. > >> > > >> > Fix the off-by-one in the range comparison to prevent this and slightly > >> > improve performance. > >> > > >> > Fixes: 50e782a86c98 ("efi/unaccepted: Fix soft lockups caused by parallel memory acceptance") > >> > Link: https://lore.kernel.org/linux-mm/20231101004523.vseyi5bezgfaht5i@amd.com/T/#me2eceb9906fcae5fe958b3fe88e41f920f8335b6 > >> > Reviewed-by: Kirill A. Shutemov > >> > Signed-off-by: Michael Roth > >> > >> More justification for introducing a common ranges_overlap() helper somewhere :) > >> > >> Acked-by: Vlastimil Babka > >> > > > > Thanks, I'll take this as a fix. > > Ping, can't see it in mainline nor -next? > Apologies - queued up now.