Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1770905rwd; Wed, 17 May 2023 00:47:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ538r7F/cxE++FKJ3PIQtaCRPKAUykOzy5R/b2VfNUhu0WkVoDXYlsbquLOZEoN5bTAS7jw X-Received: by 2002:a17:903:41ca:b0:1a6:abac:9cc with SMTP id u10-20020a17090341ca00b001a6abac09ccmr47176048ple.66.1684309656199; Wed, 17 May 2023 00:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684309656; cv=none; d=google.com; s=arc-20160816; b=X5fFtSi8Mg+VQzRcnf98vzIYWJQlXug2ukUh89HcXCPylbN2k17DjcO6PcoKz4hm3y IgWPl5uFOkXMW33dKy7zPySpdu+A66r14J7ykNn22qy+3EqzJI0HM5s6hHPvGJ29qeQw XhD2B1PqSDmUo7lDTAnXsS32CQitRbjJbYaw/rvGlT5/L12xvI9muAJIO/hCAXKNiLtE noDFUKjMzLXgEnMpvX5kYotXED2fECWCAjfdiyvLiKRT0na+DGS5ZpJKkFs+AdlVTFzN 3DSfVAnOoJ5iFL2Hx59lOM5DpjVE9lBNOy5pH5ki3Powq9yVdS4AvtlI7BlBMFn6JYQE LJug== 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=hcKgMqBaVIqZoOwjyxizzLY6i35d7PAbT8GtOYflIfk=; b=AyrLL2CAfkJfKDBv1j/QIkNso3WuhBkeqyEarK4THUQ3glRZF5V+OMt+pEaftsqZuN vqTyjP4ndJTUaLpb+Rbuyg2goZXEQvC0rJs27en968EY95U2hppomJNNP+kZ93NG3lp4 yWIiGm4lQrEmjgSbrBSTOwkV6jI4jGhEtrTiIz48PExCuw4iABd7BvkQ+Zjd9IU4ZDPV crBjQSD90uI8iPub2psjKL/4uAolDzqKimdnDIFTmGiLGXdYpnW7C2383BI+i6qrSAqS 3jWjg3Ap9kNi5prjxHINAlohKVsYr4GFEsgVWBRWG7cg0QG4lydH28bWHdsLIA+v/kkv BabQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=fqgCRcaF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b001a95d336558si2792529plr.594.2023.05.17.00.47.19; Wed, 17 May 2023 00:47:36 -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=@infradead.org header.s=bombadil.20210309 header.b=fqgCRcaF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbjEQHfj (ORCPT + 99 others); Wed, 17 May 2023 03:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbjEQHfG (ORCPT ); Wed, 17 May 2023 03:35:06 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FF92448A for ; Wed, 17 May 2023 00:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hcKgMqBaVIqZoOwjyxizzLY6i35d7PAbT8GtOYflIfk=; b=fqgCRcaFzw3/J6P9X/XIEYB7c/ m4m1SzOzwxAy+e0MN7AfudrnRjsla5m3WrVZuhFLh/kE8QAsriNEh2qXwYMAehf1+bCbOHNPIvQgz BhdZ6GvATpmwGEnRx0jwHXvYm0NUrg+sd0MCJ5sWMaW5OpY/dbubDOX1o/tTa/QcYd/SFyF2gm4yJ 3HbXkNE1Qkthwx+tpCOTdM2Ldfbewcy/jTAp/HJJ2DRw7Jn3cSg3eVSTruRbmS1Evl/bZ3/Q79U7O duNkcsRIqalJfa2J0wStc9PGKv3ZT62ZgcwkbXFc6lY3NYDB0eiqxwYdRLKTAsToiJp9tBO4+Myil bNUZI2Vw==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pzBgY-008gi7-04; Wed, 17 May 2023 07:34:58 +0000 Date: Wed, 17 May 2023 00:34:57 -0700 From: Christoph Hellwig To: Xiaoming Ding Cc: Jens Wiklander , Sumit Garg , Matthias Brugger , AngeloGioacchino Del Regno , op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, fei.xu@mediatek.com, srv_heupstream@mediatek.com, linux-mm@kvack.org Subject: Re: [PATCH] tee: add FOLL_LONGTERM for CMA case when alloc shm Message-ID: References: <20230517031856.19660-1-xiaoming.ding@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230517031856.19660-1-xiaoming.ding@mediatek.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 > + u32 page_flag = FOLL_WRITE; > > if (!tee_device_get(teedev)) > return ERR_PTR(-EINVAL); > @@ -255,9 +256,11 @@ register_shm_helper(struct tee_context *ctx, unsigned long addr, > ret = ERR_PTR(-ENOMEM); > goto err_free_shm; > } > - > +#if IS_ENABLED(CONFIG_CMA) > + page_flag |= FOLL_LONGTERM; > +#endif > if (flags & TEE_SHM_USER_MAPPED) If this mapping is long live it should always use FOLL_LONGTERM. The ifdef does not make sense.