Received: by 10.192.165.148 with SMTP id m20csp617745imm; Fri, 27 Apr 2018 04:54:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrAnhy9oBbgpX6czAPs9EYJaCoYg8SvbYjs4p5cCBSqZgdY7MRpzmOPv0kebXJfHXFVnNpD X-Received: by 10.98.92.129 with SMTP id q123mr1977330pfb.252.1524830044107; Fri, 27 Apr 2018 04:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524830044; cv=none; d=google.com; s=arc-20160816; b=JCxhN/pGKCaOEdKN3beSBdED670fyEEGeK/h0rQFNesSX3ggumjJvB1wkOX02msmuM GkkQHYLDw7iLDB0HotcNJmby4QUVIzPwp4tge4xVfPJ2gOBvmcEw/bzehcl4hR7Nvt9t rpCvs6PHhOjWnD4SXpX9yC6XpTI3l3cArgyYEg4qZCbglEPeZAPJvY4pitZNqC6pcKAv eim7cccjUcZ9ZA6R3ymJX7sH1VM2B/XXJBrfmzt7q58dvgyGxW9eBUQmbC0HoBxJ8A3b ztJOPPo0wreho+5NhZeecrW4XJETM93RVHHmug5y7fRtlMOMuNMJJBS8esxCbm1PMlcw cO7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=SC9iP6mPoOiAl+NHJquuPupCJ0ORBVetL38/ZlgM/u8=; b=hqlC9/7OJgZTrFVlZ4MBmZAkzMs66XMvsb2wIpeDso8aPlrMSEAc/UXMIQz2RG5MCf DsNXUxWjca6UvR+yCeYmABWL44NrsJZrElgwuipfobEB/2YooD97znUccd2r7Tlh6XI+ jH20+OmE/c3l1WdQPkjRA0pew7nsPCslKZ8SoRzh/SAgpEjTP1nIMe+05sbR5MQOhWlV 3wusXhZDidU8Ga9fa5XDcSkRN1dzH3AQtHtoyfWCcRVUDDnUr3mWmzLEZwX6sniDXaX4 M4Jsaf0r6QvyDUNxYmnIQtAo13LcUVi1+rPgOPkuKYtgAXEPV1SreVqkdgaTaDDN62wD GvYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=gHArKzq9; dkim=pass header.i=@codeaurora.org header.s=default header.b=HzVsB3Zj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si1100597pgn.634.2018.04.27.04.53.49; Fri, 27 Apr 2018 04:54:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=gHArKzq9; dkim=pass header.i=@codeaurora.org header.s=default header.b=HzVsB3Zj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757999AbeD0Lwo (ORCPT + 99 others); Fri, 27 Apr 2018 07:52:44 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34778 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608AbeD0Lwl (ORCPT ); Fri, 27 Apr 2018 07:52:41 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F30E060F74; Fri, 27 Apr 2018 11:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524829961; bh=Kd8yD5hCDd568rZjMFTEB8e1E9150Ho1kEtdWZQns9g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=gHArKzq99iXAzU1ZakauHySFwU0m8P7Cp2Bxo3o4yG4KCFMnIgEIIyQXN+XhQ9mhs CybUgRNijnpcDPvq/UpFi2VvKV4CX16SKcbeoCVRVQwege54EAry3Xn0XSEHqEq58x 0qnY4MCDAZCDKXw7Gs2z17R5Sl2b2IzR01QbQdjc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.79.109] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E8C1A6034E; Fri, 27 Apr 2018 11:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524829959; bh=Kd8yD5hCDd568rZjMFTEB8e1E9150Ho1kEtdWZQns9g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=HzVsB3ZjBsJvrUgi2acB/2UFaqNf6qVVGgPe1/5oK5iGvQa9+IHphzDYechA+zblt B0zKdgYTHy23I5MIPG4n+//2/4VN1EqdnrVsRviTFff+IMrg8mVnXzz/xA6pz89RhU 2lG6K4hxZ/E4ZaHtiMNVzgJKdhejBJWGUe2N4BE8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E8C1A6034E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org Subject: Re: [PATCH v2 2/2] x86/mm: implement free pmd/pte page interfaces To: "joro@8bytes.org" , "Kani, Toshi" Cc: "Hocko, Michal" , "hpa@zytor.com" , "wxf.wang@hisilicon.com" , "catalin.marinas@arm.com" , "x86@kernel.org" , "will.deacon@arm.com" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , "linux-mm@kvack.org" , "mingo@redhat.com" , "willy@infradead.org" , "guohanjun@huawei.com" , "tglx@linutronix.de" , "bp@suse.de" , "akpm@linux-foundation.org" , "linux-arm-kernel@lists.infradead.org" References: <20180314180155.19492-1-toshi.kani@hpe.com> <20180314180155.19492-3-toshi.kani@hpe.com> <20180426141926.GN15462@8bytes.org> <1524759629.2693.465.camel@hpe.com> <20180426172327.GQ15462@8bytes.org> <1524764948.2693.478.camel@hpe.com> <20180426200737.GS15462@8bytes.org> <1524781764.2693.503.camel@hpe.com> <20180427073719.GT15462@8bytes.org> From: Chintan Pandya Message-ID: <5b237058-6617-6af3-8499-8836d95f538d@codeaurora.org> Date: Fri, 27 Apr 2018 17:22:28 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180427073719.GT15462@8bytes.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/27/2018 1:07 PM, joro@8bytes.org wrote: > On Thu, Apr 26, 2018 at 10:30:14PM +0000, Kani, Toshi wrote: >> Thanks for the clarification. After reading through SDM one more time, I >> agree that we need a TLB purge here. Here is my current understanding. >> >> - INVLPG purges both TLB and paging-structure caches. So, PMD cache was >> purged once. >> - However, processor may cache this PMD entry later in speculation >> since it has p-bit set. (This is where my misunderstanding was. >> Speculation is not allowed to access a target address, but it may still >> cache this PMD entry.) >> - A single INVLPG on each processor purges this PMD cache. It does not >> need a range purge (which was already done). >> >> Does it sound right to you? > > The right fix is to first synchronize the changes when the PMD/PUD is > cleared and then flush the TLB system-wide. After that is done you can > free the page. > I'm bit confused here. Are you pointing to race within ioremap/vmalloc framework while updating the page table or race during tlb ops. Since later is arch dependent, I would not comment. But if the race being discussed here while altering page tables, I'm not on the same page. Current ioremap/vmalloc framework works with reserved virtual area for its own purpose. Within this virtual area, we maintain mutual exclusiveness by maintaining separate rbtree which is of course synchronized. In the __vunmap leg, we perform page table ops first and then release the virtual area for someone else to re-use. This way, without taking any additional locks for page table modifications, we are good. If that's not the case and I'm missing something here. Also, I'm curious to know what race you are observing at your end. Chintan -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project