Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3353416rdg; Tue, 17 Oct 2023 11:56:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTUn2cOogLi2232MVWcpH8a8QcCRE6fS9GeI+sE9Xywg7Og2rChgXyos1bDiJ2R64YP+Qg X-Received: by 2002:a17:902:ec83:b0:1c7:23c9:a7e1 with SMTP id x3-20020a170902ec8300b001c723c9a7e1mr3276918plg.26.1697568960089; Tue, 17 Oct 2023 11:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697568960; cv=none; d=google.com; s=arc-20160816; b=vPQKLjaDESWl7tPXDqI4/CmBoQwiqoLIXzS2FMSWsf0/4l4MGGvNhsqJE3LF6WkvQ0 HxFOHNWUEpl97zNiLrxhGcc6g/V38H33JsNR9s4putKfRllDp6v9TPfVTP5wtG3myff6 F/1vWrAZJfWu5sY7ebbvLdO/Jg8FfBUpURxVSP+gn3c7U+zubox/Ieu8vEHlPcda1o3Q kIjPAO3qqd3HHMNLvn6yTG2oz/3RPnS6qKeZ6ElRDxJdzOOnreQAUPCja+ftyUo71jL8 hI01CJVJRlcddTeGdTiQam1YwwUMoK+Yykt0hJvyptuYiyBY9II8icozBKNHjHZzu/TD GqUQ== 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=6wQOh3FH9b2rnyijAjQaLtuaZg6t2cVu7jm6tXATJYw=; fh=+6E3QeFqBqp+QhlM5P1wR8l/lKv9be8p4pbn2NN4/TY=; b=epa9U8tIqTYpHK6mNUShXZKCz6M91qNqFQg8UjTMfa0Yx8vkc8w0cuoWai9jxs/7sV DIiZ5+jqzwPDbRJayfdjl8+hiPZSENUW7IBA/B6ULquP0N2LXO5ieYqrX+elzYDPxAet GdkZsK0+xcQj//QXP54N6JgYLy/uhHybNJBXVcfTS7JDoQce/vA6jLed4dkfuHER0Qji F6cf4L9q2qlDd93yqL9v9/WQmqRiPgV1yBqA0D0buYxUfmRVx+WssOfof2KKCqT2HQRR Q2CfPElRhcv8otDTEdFZ3/4SofmnYZCdvrgNchNVbd1KZlrbHNI2KdG0cxY9QnhASOMI d1yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=bupwfa13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y12-20020a170902ed4c00b001c62b9d56f8si2205144plb.606.2023.10.17.11.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 11:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=bupwfa13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 88952807B9AB; Tue, 17 Oct 2023 11:55:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235021AbjJQSzA (ORCPT + 99 others); Tue, 17 Oct 2023 14:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbjJQSy7 (ORCPT ); Tue, 17 Oct 2023 14:54:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 587BEF5; Tue, 17 Oct 2023 11:54:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CF4371F8B5; Tue, 17 Oct 2023 18:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697568895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6wQOh3FH9b2rnyijAjQaLtuaZg6t2cVu7jm6tXATJYw=; b=bupwfa13hhgne16QMB8JCzQVS/2H7SV0HOqyzL0hemmXj+KZaUOhwdGuTvyJI1MRzrjSn5 zKQktwiIgjjGdUPwynyoJyC/pcS4fDQpiZaVbXOzeqtrjR2X0zZegVAz82C5zuxCKBABRn kUrimFf5KOWe5U0Y4QlkWKy1nlncKjQ= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 803C713584; Tue, 17 Oct 2023 18:54:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id crmSHn/YLmWzIgAAMHmgww (envelope-from ); Tue, 17 Oct 2023 18:54:55 +0000 Date: Tue, 17 Oct 2023 20:54:54 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Haitao Huang Cc: jarkko@kernel.org, dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, x86@kernel.org, cgroups@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, sohil.mehta@intel.com, zhiquan1.li@intel.com, kristen@linux.intel.com, seanjc@google.com, zhanb@microsoft.com, anakrish@microsoft.com, mikko.ylinen@linux.intel.com, yangjie@microsoft.com Subject: Re: [PATCH v5 16/18] x86/sgx: Limit process EPC usage with misc cgroup controller Message-ID: References: <20230923030657.16148-1-haitao.huang@linux.intel.com> <20230923030657.16148-17-haitao.huang@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="edw5ydf5cclnwdcr" Content-Disposition: inline In-Reply-To: <20230923030657.16148-17-haitao.huang@linux.intel.com> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -7.86 X-Spamd-Result: default: False [-7.86 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[20]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.16)[95.97%] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 17 Oct 2023 11:55:10 -0700 (PDT) --edw5ydf5cclnwdcr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 22, 2023 at 08:06:55PM -0700, Haitao Huang wrote: > +static void sgx_epc_cgroup_free(struct misc_cg *cg) > +{ > + struct sgx_epc_cgroup *epc_cg; > + > + epc_cg = sgx_epc_cgroup_from_misc_cg(cg); It should check for !epc_cg since the misc controller implementation in misc_cg_alloc() would roll back even on non-allocated resources. > + cancel_work_sync(&epc_cg->reclaim_work); > + kfree(epc_cg); > +} > + > +static void sgx_epc_cgroup_max_write(struct misc_cg *cg) > +{ > + struct sgx_epc_reclaim_control rc; > + struct sgx_epc_cgroup *epc_cg; > + > + epc_cg = sgx_epc_cgroup_from_misc_cg(cg); > + > + sgx_epc_reclaim_control_init(&rc, epc_cg); > + /* Let the reclaimer to do the work so user is not blocked */ > + queue_work(sgx_epc_cg_wq, &rc.epc_cg->reclaim_work); This is weird. The writer will never learn about the result of the operation. Thanks, Michal --edw5ydf5cclnwdcr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQpEWyjXuwGT2dDBqAGvrMr/1gcjgUCZS7YfAAKCRAGvrMr/1gc jiXBAQCjRWtn93e1A3lqtdgEQbgCQbqbDof6U4NlLFxKtLfdygD9HjQFcAbLr/8e MoCT1oqhzmRq++UsUrnxa/WIAnreTwI= =CV66 -----END PGP SIGNATURE----- --edw5ydf5cclnwdcr--