Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3889039rwb; Mon, 5 Sep 2022 21:49:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4CjitB0q9n/7eGQ+WDq2+m7gXpZaq1SWA+MCe1hjbiL2EhZI1r6iP7hpTEmnNZlycEQDxh X-Received: by 2002:a17:907:6e0b:b0:73d:5850:ca15 with SMTP id sd11-20020a1709076e0b00b0073d5850ca15mr38868793ejc.344.1662439791369; Mon, 05 Sep 2022 21:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662439791; cv=none; d=google.com; s=arc-20160816; b=O5+FwlEBPVj0yYuJmPN9tfpIQLKRskvEdS7jUTUgokZiV0JBKnNdiKusn+jPI6CtKU fXUG+VgX7h00h115lwYfRn0UFndC2b66yG3Gw1o8Dg7rjVSFDjolKtnhA6xt+CMVOlRK xIF5w37mFjfOpeyZtoMo9dc4GygPL9FnG+D0qlYYIFEbjOks39TjkvuupqJDywOwDWD5 ODkYWek1Y/+/WiNt+TcsEjtKbM+ZlR/O/jCAPMxeZfixeW1PuY9IMks6xSjTDFkxM552 9vGQjO4edOkAU+KOWroF/4NlLvhLrGvQE0zSkwS+NAk/0G1oIY1t9NEctTqdFDatFvYt kIlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FD1OqYbw+KzyEp/eUY8LX0a62NuraKWmbZismaJRMVI=; b=X/dr7ybuMxCDwH7Vk6Y5qsk+7rzHnd3T+/iKMaYMAaWBYEOOYMw58CA6nPYGTQ0S/R paPrQes99Du6642mbDNwb4juN6lNZEM+vC+if3JeczrBeqgI9VmWnvxlCsg9DNw5G9FY BTeSYdkRRnoFRqWZdIOBPfrPh8+mcVWfRFfbUvjwLv2Ifj8/z2RACu4SPCCYiUBlKBI1 66yL+r+jBHXkTYwT8Pqdz3qjvjKXKXQDY5Xz4iD7BcX4KeYLZEQdOlCFSm3fBnWPmldI P4MHozVUgEyvlkeFAn/Uy50F2bqaE7yq/y5UlsWSZlhGt4WGQq5WQKBxqIUp7K+s/8is iuUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OGHiVYHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a056402269400b00447d32305f7si49875edd.54.2022.09.05.21.49.26; Mon, 05 Sep 2022 21:49:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OGHiVYHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231992AbiIFDwZ (ORCPT + 99 others); Mon, 5 Sep 2022 23:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbiIFDwV (ORCPT ); Mon, 5 Sep 2022 23:52:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1806412AE9; Mon, 5 Sep 2022 20:52:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1300B815CB; Tue, 6 Sep 2022 03:52:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 325C9C433D6; Tue, 6 Sep 2022 03:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662436337; bh=zFRC/saudT5ocL2B+pAQnl1JeST/8SgqT3A8O4f16tM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OGHiVYHi2xZXjHMJndgvoCYl7B5uCh4D314q8MY3hkraS4Cxm8rrwqj+UFEP06f5N TEzPRuibE996H8IA2HME4cS/EMJs0iWdsNs2xINnp6ka70dUHHOPIloaIeghn0zdAW zSgxigkCg5v0h7XSgzcYeLwrj9iB/aJISZWHNNMZW4z2WzokVBs6rlhlVAXc2+pbJ4 mbKD7eFhCI5Owbh/E6II290tfSvfyF2bwjosq3ZG002YtQqDFpqgYkliZEqBeOcNZl cSIWDJGURww8adOmiMwN5IgZLopICS3DzkmNX512ngC+XdCWxqTW33q15lELAbCZCc ZvRqYxbXkv24A== Date: Tue, 6 Sep 2022 06:52:14 +0300 From: Jarkko Sakkinen To: Dave Hansen Cc: linux-sgx@vger.kernel.org, Haitao Huang , Vijay Dhanraj , Reinette Chatre , Dave Hansen , Kai Huang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH RFC] x86/sgx: Use a heap allocated list head for unsanitized pages Message-ID: References: <20220906031230.107108-1-jarkko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 05, 2022 at 08:20:18PM -0700, Dave Hansen wrote: > On 9/5/22 20:12, Jarkko Sakkinen wrote: > > Allocate the list head for the unsanitized pages from heap, and transfer > > its to ownership to ksgxd, which takes care of destroying it. Remove > > sgx_dirty_page_list, as a global list is no longer required. > > > > Signed-off-by: Jarkko Sakkinen > > --- > > Depends on https://lore.kernel.org/linux-sgx/20220906000221.34286-1-jarkko@kernel.org/T/#t > > Would this be plausible? > > --- > > arch/x86/kernel/cpu/sgx/main.c | 44 ++++++++++++++++++++++++---------- > > 1 file changed, 31 insertions(+), 13 deletions(-) > > What's the benefit? I guess it saves 16 bytes of kernel image for ~20 > lines of code. Does it add more than 16 bytes to kernel text? ;) That's why I asked, and added RFC. It was so small step that I thought to try it out. I agree that it does not save memory for any significant amount but it does take a bit way from driver global data, which is IMHO most of the time +1 (simplifies state). Not saying that enough to pick this but perhaps it will find its place as part of a patch set. By itself it does not stand, I agree. BR, Jarkko