Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp988928pxb; Fri, 15 Apr 2022 17:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4+YfP8L+f5z+Iww5T1+Y/0DJf5ePaDVMhkgoyy2AKKwE+UVj33fp8RzRiyBWjHIZh2VC0 X-Received: by 2002:a17:90a:e692:b0:1cb:a04d:eb8c with SMTP id s18-20020a17090ae69200b001cba04deb8cmr6759906pjy.27.1650069213755; Fri, 15 Apr 2022 17:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650069213; cv=none; d=google.com; s=arc-20160816; b=FXQwIbDRZYDPmWSHZ/WX7HQH0H+6wcqnpIdWXQXHes2xI1oKcXbz0fAgrZsl9RRwrC ldp5R4QTZhS00T7KwftCv3IO1PRE1lORRtDKhzP6UuwSfRCUBdrInKeeqKvPtzfwo8WN ATs0/iP6znZEvnXGNacOm4BGWRCUw/eM5V/TntYB31Qd3HpQhooTx2rZVN2PE54YuU+L KfjV2FQeqqTsiPxi2jSF+cP6gEimti7uY0sAI5PkrxAsmORzDmB4HGijYMzq1BWL1jn4 MrI5hNckjU8AMqorLcpWVuBBORDk5nNnlSbZQksjlpNrtCn/J1A4u7VdMATEsM8QZY5q ENpA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Owf8mqAyp6s3zrum6RmCgeJvV+v7y8ZzI3VvxQ4KFMI=; b=w+FO7+JdCYzUN9U6lAuwJMoPlg1HCLPIUZ0oD+OeSR8S8CuB5Pqvsa4z89X3Xt+H9L AX8jP2Wlg29L8PCX09KRAWX4Hy3xIFk6ovjpXy6Wg7xAeiEbFizOh5bR8EDt8UerBpOc ybc47GmkRKTlBMsRrJtwt9GS/5pt75VJ+hTECku6BRKCovykhSHvdiyGFG1SaxMEnWx8 kSprZtx98bQ0Hwrqzl4p8AlxTeoZZgBs9Z7IShz6KA319DPadWBWxkgJQtKb09Bj17BK WCkOq/u/7C05dQfbsvIB37Dn7+YSela5IxmW2mipyCSLU0gzAcLlPEYIc1+1eMRSkW/b O2bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nZVRkW3M; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p8-20020a17090a930800b001cd4e41f205si2739550pjo.169.2022.04.15.17.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:33:33 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nZVRkW3M; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9151B31936; Fri, 15 Apr 2022 17:29:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353903AbiDOMlK (ORCPT + 99 others); Fri, 15 Apr 2022 08:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353834AbiDOMjy (ORCPT ); Fri, 15 Apr 2022 08:39:54 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5605C9B6B for ; Fri, 15 Apr 2022 05:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650026230; x=1681562230; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=w+XDpmr+jFjSlmGjB+amwAH4Rfhi8cJjFE5vaPuGp/A=; b=nZVRkW3Mzlz8ujnN8mdXSq/a1tM7WoT9oYtziNBR5ckhucS565lDFQpH EFb1ZCZUU4Lc9q2hK9DXmf0b5+s8XJD5C1qz4kLun7AyX3qWXUb6hn6lF 1qh599tEFL6kqSgR06JCpxyhSX4IyO7kqRSsh30k6VIAZbu1THzaJ6AsM lauOcIqQdahrFeiHWdd3TOveichah7hrLwnxhqva+uaMAfk+A6jJo402e fVPpFUgAc1FsP9o1uw+lbuhXGG2wjqWXUM+A3ukbchf2RgnAYAAck+A3p B3W1qR3kbWnLgCIZ3jmYtdapoD/nR+lxD4gEIhR05R3p5S3EaYu9m8PgI A==; X-IronPort-AV: E=McAfee;i="6400,9594,10317"; a="326051050" X-IronPort-AV: E=Sophos;i="5.90,262,1643702400"; d="scan'208";a="326051050" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2022 05:37:10 -0700 X-IronPort-AV: E=Sophos;i="5.90,262,1643702400"; d="scan'208";a="508930396" Received: from fyu1.sc.intel.com ([172.25.103.126]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2022 05:37:09 -0700 Date: Fri, 15 Apr 2022 05:37:34 -0700 From: Fenghua Yu To: "zhangfei.gao@foxmail.com" Cc: Dave Hansen , Joerg Roedel , jean-philippe , Ravi V Shankar , Tony Luck , Ashok Raj , Peter Zijlstra , Dave Hansen , x86 , linux-kernel , iommu , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Josh Poimboeuf , Thomas Gleixner Subject: Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit Message-ID: References: <99bcb9f5-4776-9c40-a776-cdecfa9e1010@foxmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi, Zhangfei, On Fri, Apr 15, 2022 at 07:52:03PM +0800, zhangfei.gao@foxmail.com wrote: > > > On 2022/4/15 下午6:50, Fenghua Yu wrote: > > Hi, Zhangfei, > > > > On Fri, Apr 15, 2022 at 06:14:09PM +0800, zhangfei.gao@foxmail.com wrote: > > I download this patch from: > > https://lore.kernel.org/lkml/YllADL6uMoLllzQo@fyu1.sc.intel.com/raw > > git am to either v5.18-rc2 or the latest upstream without any issue. > It is my copy paste issue. > > I have tested, nginx woks well. Great! > > Other than the following issue, > Each time /sbin/nginx will alloc ioasid but not free. > which I think it maybe nginx issue or the mis-usage, will ask there. Which nginx/openssl function is supposed to call kernel sva_unbind? I couldn't find the function in nginx tree. If nginx doesn't free ioasid, it will cause ioasid leak and memory leak. > > Tested-by: Zhangfei Gao Thank you for your testing! > > > > > > It should work for arm. > > > > > > In fact I have a similar patch at hand but pending since I found an issue. > > > > > > I start & stop nginx via this cmd. > > > //start > > > sudo sbin/nginx                    // this alloc an ioasid=1 > > > //stop > > > sudo sbin/nginx -s quit    // this does not free ioasid=1, but still alloc > > > ioasid=2. > > > So ioasid will keep allocated but not freed if continue start/stop nginx, > > > though not impact the nginx function. > > > > > > stop nginx with -s quit still calls > > > src/core/nginx.c > > > main -> ngx_ssl_init -> openssl engine:    bind_fn -> ... -> alloc asid > > > But openssl engine: ENGINE_free is not called > > > > > > Still in checking nginx code. > > > > > > Or do you test with nginx? > > On my X86 machine, nginx doesn't trigger the kernel sva binding function > > to allocate ioasid. I tried pre- nstalled nginx/openssl and also tried my built > > a few versions of nginx/openssl. nginx does call OPENSSL_init_ssl() but > > doesn't go to the binding function. Don't know if it's my configuration issue. > > Maybe you can give me some advice? > I am using openssl engine, which use crypto driver and using sva via uacce. > nginx -> openssl -> openssl engine -> sva related. I'll do more nginx experiments. > > > > > I test the patch with a few internal test tools and observe mmget()/mmput() > > works fine in various cases. > OK, thanks Thank you very much! -Fenghua