Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2996122rwb; Fri, 9 Dec 2022 08:42:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5o6glTktz5o6vDcaqfZNbuGENxxkNzP0vcIikhBHIqtZBgsNQFunB8Q0NSsjj3sHbjGdkp X-Received: by 2002:a17:90b:2748:b0:212:ee66:f1ec with SMTP id qi8-20020a17090b274800b00212ee66f1ecmr6285271pjb.46.1670604154348; Fri, 09 Dec 2022 08:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670604154; cv=none; d=google.com; s=arc-20160816; b=EIR5SYy6tCiOYqBl2tWNOhu7XAXOZLuwzUyRqLGc6miSeDJYCIMmyK8gK3Gj9cwH9T oUqf2UDIPuubpbfv/jFk/E1doJj+NPUUQq8WChMSa/8YyLRGEXAzTBnRQhCdCoYxwu1w jRd2qsWh6QF+dkFHsz9UgjuXxgKl+lIpzudbxJdHrKr4KBfRiAvbUVXIbh+bFxnYxuVD uhlv9hxzMA3k+zG8uxSC1UUVwJjLXo3ol5iPks8NrC+3Zjlj4w3aQdanWcfNMMZU8xIK N6q6pFtKeQc1wkUobo1LFRuVgqh6J/StMXLHVlnlHzJFF8UT0by3P60doOztFPsepLgm Uv4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=gboxpoVTdd6Q1lhf8cnxP6k7pgCfg0xUBrWzpp3xLrA=; b=s6As1o7HWOy5qc6cnLYdamsgWYhoRDGKW1lz8rPt2mRd+9tBVT1WJXtjXYaa8Fa0dp juM8jtxc3n9j/D/P62Kz8dYYbZ70xvvn0jWHQnuzr7rlpZfFOYtSa6RtQi2DdL20B7Ai qPa6lFfItQ9hbxZZxOR+bRMxafwbt7RuHjC88Ms4sb4Eypb/zHGRri4O9QO/Pqu4usbq jccfmpWNJSGqEJDEYw8Mzl/HDE0XhijZMIESh5PhtZFqYVk7UpF43tjzZzzvSRsNXkAv x8u0okRWoZkx4seRYACDnuRa5UbidgwY728UtukdoWvuU9lSew2rbiW2U61V8SA76K2Z 58wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MfIU6d/7"; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b196-20020a6334cd000000b0047899806ee2si1705412pga.533.2022.12.09.08.42.24; Fri, 09 Dec 2022 08:42:34 -0800 (PST) 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=@intel.com header.s=Intel header.b="MfIU6d/7"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbiLIQWi (ORCPT + 74 others); Fri, 9 Dec 2022 11:22:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiLIQWh (ORCPT ); Fri, 9 Dec 2022 11:22:37 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95BF41C0; Fri, 9 Dec 2022 08:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670602952; x=1702138952; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=iQwVqHB9rC9aTwo4Z445IcUifA5rNpwqLqEuyYsANns=; b=MfIU6d/730wqghMxeJTBwiLhdIjCe5UmOtnoB/UBGfO495Qhq43G57BE sys8Se8M3EZhhpM2tFvIh8rQrp0pqqNDl7tVM+zZM4BoUFSpuFG/Tp2qW FV9jRZz6RPphCtmmAs0ElwXm8Mvz2XppoWQAhsTSeS48z+LRmYMgNqGwI w6QuBTbswIoKRaA0hI8g7je/ahzE5s/YENCu+gInTBxOUjrZUjIolzHwv ygt18rXP/zSFAQM3M9PlNWhOYIbI8/unPJfwl3MjMq1djjaYpHQhbdTPl C73oMeJ40V6NAJ1EmSh7cebeU87cTnuYk/brfHsMFucHGwt5f9eotfGUn g==; X-IronPort-AV: E=McAfee;i="6500,9779,10556"; a="315129265" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="315129265" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 08:22:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10556"; a="754083892" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="754083892" Received: from hoonpark-desk15.amr.corp.intel.com (HELO [10.209.54.118]) ([10.209.54.118]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 08:22:27 -0800 Message-ID: Date: Fri, 9 Dec 2022 08:22:26 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 14/18] x86/sgx: Add EPC OOM path to forcefully reclaim EPC Content-Language: en-US To: Kristen Carlson Accardi , Jarkko Sakkinen Cc: dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , zhiquan1.li@intel.com, Sean Christopherson References: <20221202183655.3767674-1-kristen@linux.intel.com> <20221202183655.3767674-15-kristen@linux.intel.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE 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 12/9/22 08:05, Kristen Carlson Accardi wrote: > Aside from that though, I don't think that killing enclaves makes sense > outside the context of cgroup limits. I think it makes a lot of sense in theory. Whatever situation we get into with a cgroup's EPC we can also get into with the whole system's EPC. *But*, it's orders of magnitude harder to hit on the whole system. Basically, it has to be at a point where all of the EPC is consumed in non-SGX-swappable page types like SECS or VEPC pages. That's _possible_, of course, but it's really hard to create because one VEPC page can hold the info of several (32??) swapped-out EPC pages. So, you'd need roughly 4GB of swapped-out normal enclave memory to exhaust a system with 128MB of total enclave memory. OOM handling *much* necessary in practice if you have a cgroup with some modestly sized enclaves and a very tiny EPC limit. If someone wants to extend this OOM support to system-wide EPC later, then go ahead. But, I don't think it makes a lot of sense to invert this series for it.