From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBCC8ECAAD5 for ; Fri, 2 Sep 2022 15:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236300AbiIBPae (ORCPT ); Fri, 2 Sep 2022 11:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236334AbiIBPaH (ORCPT ); Fri, 2 Sep 2022 11:30:07 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BE09D346B; Fri, 2 Sep 2022 08:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662131371; x=1693667371; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=6wbQJaovjWSecMUq+Mtuf5ZeCJqt9CRGZgfkgAn0Lnw=; b=nhwHj75nKiGKgmHeG6Q9w+oSVZboCnnlfDxR/mfZWncea8Tm6PaZJ9NT k6ZdZbITw1Onz36JDokmJ8frVC5CjoZaAAA1oLmU5tUqJYoLS7hhCZOBy klfjZ2iuLSG8qdEcF9r3R3xY/skt1uIrfWRc4qO4o8G8ovE/hEbDTp1y9 TWEPMHLijuT1DbxVa1BWA2J7Qm6LBFIZ1zgLzRE2MY/oj5XNvTRx89vQe GKb874XjcT6VKRbsNTsW7hq9i5PdrDmpaMhkKipPwb5lH9l56qt7PMD9t lMf42XSzpBHflsacW81VV4jUl/LIXO7rMtbwnEGx0CrGPY3hFRT9gkula A==; X-IronPort-AV: E=McAfee;i="6500,9779,10458"; a="357715435" X-IronPort-AV: E=Sophos;i="5.93,283,1654585200"; d="scan'208";a="357715435" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2022 08:09:30 -0700 X-IronPort-AV: E=Sophos;i="5.93,283,1654585200"; d="scan'208";a="642937673" Received: from tanjeffr-mobl1.amr.corp.intel.com (HELO [10.212.156.60]) ([10.212.156.60]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2022 08:09:30 -0700 Message-ID: Date: Fri, 2 Sep 2022 08:09:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] KVM: SVM: Replace kmap_atomic() with kmap_local_page() Content-Language: en-US To: Zhao Liu , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ira Weiny , "Fabio M . De Francesco" , Zhenyu Wang , Zhao Liu References: <20220902090811.2430228-1-zhao1.liu@linux.intel.com> From: Dave Hansen In-Reply-To: <20220902090811.2430228-1-zhao1.liu@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 9/2/22 02:08, Zhao Liu wrote: > From: Zhao Liu > > The use of kmap_atomic() is being deprecated in favor of > kmap_local_page()[1]. > > In arch/x86/kvm/svm/sev.c, the function sev_clflush_pages() doesn't > need to disable pagefaults and preemption in kmap_atomic(). It can > simply use kmap_local_page() / kunmap_local() that can instead do the > mapping / unmapping regardless of the context. > > With kmap_local_page(), the mapping is per thread, CPU local and not > globally visible. Therefore, sev_clflush_pages() is a function where > the use of kmap_local_page() in place of kmap_atomic() is correctly > suited. This changelog is a little on the weak side. You could literally take any arbitrary call-site and file for kmap_atomic() and slap that changelog on it. For instance: In drivers/target/target_core_sbc.c, the function sbc_dif_copy_prot() doesn't need to disable pagefaults and preemption in kmap_atomic(). It can simply use kmap_local_page() / kunmap_local() that can instead do the mapping / unmapping regardless of the context. With kmap_local_page(), the mapping is per thread, CPU local and not globally visible. Therefore, sbc_dif_copy_prot() is a function where the use of kmap_local_page() in place of kmap_atomic() is correctly suited. That's all valid English and there's nothing incorrect in it. But, it doesn't indicate that any actual analysis was performed. It's utterly generic. It could literally have been generated by a pretty trivial script. It would be great to add at least a small, call-site-specific human touch to these changelogs. In this case, saying something about how global the cache flush is would be a great addition.