Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp1996862lfo; Sat, 28 May 2022 13:09:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1qC2Goaogf5FIZAi7JhN43/DKqzXZ8yl8nf5VKSrruzYUjKZA5CGsoBU7Wq0MHzCJCpU8 X-Received: by 2002:a65:6e44:0:b0:3db:219e:2250 with SMTP id be4-20020a656e44000000b003db219e2250mr42567595pgb.369.1653768596031; Sat, 28 May 2022 13:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653768596; cv=none; d=google.com; s=arc-20160816; b=nhXFJCfbvGPZl0SAh5nRD5pkoQVtcNTVVqO4HQmFdWwKf0jt75J4hI9dWHRpCBrdrc OuzrSJJd/iN7iptRvdXw4jxC9kLUIXkEuXNOWd6Tqx3Ef6592W9+AIN9SU4XRBD2pmGq +0Mk/yJGWsFKqBGdNROXH+sMRavUi0Y9XELzaXd8WT4hzcNtpZHGwi0z4KYZD7QYAFB9 j6PfnihvqL0Z3M6hZuu9fHoFU4Aei9+UuSNkG1jOwuH3xcSzBrbojWxqkdUb4oC/WB+G NWjfP55jHQcxIA2yqsqOULJ4hKngAYvJM8NV2T1/OfJ0Fhh8qotYpwPssPw5zehaZ+cy +D4w== 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=P74aMtwspWjwWjmsLf4KQ41QZOw7yOwp2tVOYZ1g3RI=; b=hOczmnJv7Lxo9rjw9qTcrJQpy21/zRtCJpQO4kb+vfJqVLK0+UD2nCMVn6torULuz0 P9cEGDVuAxd93h2T8KroTgBMMGPcV47T0sG8VB7qy9kFKcdNclTAJ1fqXUEycFSXYLlT D6mstV0vaEa84kUrI4he64+b3ylYBdxCmyuWJH4PeWXvKuaksz4RCwETfpc2NPI7xhhM rsofA9if584IvbaSOp/FN7P0xUYuNb4A3CVScBaEHtx99mKYobVfMz5DyrJNFDrzPc+t nWsBGwDIZyJ7QfHVaGdOjdpUBW8blpCVmLPzjEvTl9QezWZzGfIo8AyY0CdwWFI6t++4 bqMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q6s0RLvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 203-20020a6300d4000000b003816043f10bsi10120134pga.768.2022.05.28.13.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q6s0RLvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 9E323122B6F; Sat, 28 May 2022 12:23:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244773AbiEZUjo (ORCPT + 99 others); Thu, 26 May 2022 16:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbiEZUjl (ORCPT ); Thu, 26 May 2022 16:39:41 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E860F4A91F for ; Thu, 26 May 2022 13:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653597580; x=1685133580; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=kR26q/3oLEaaK5OFUbPNoh2OJvAlC5sl0FyJbKaokew=; b=Q6s0RLvpFSfn09tcTLKUhibaEW//204bAS+KtF5bi4TtY4BP5c+6PK05 H7qFec2NRA6UCjbdsSDNvtM3UsF2jYA/1LyZ2R/MVO5bam+NHSllORShL vvkwasUEujDIvyAVQEpmMc5eK0n2o44AgufV6aUVNBDBxL1XUQzzRlOZr m5/dDBaLxK+gYEGvjyxDgrM6DHATX+GM3ifrRkEIdw8Hy+dazpW0fJ5hR ZaxhctzwkWyQ1A2ERgYC8Ztg9+OrWnfoKqnmRdzFaSUN2IYXphLRGa4Ft 69+7PGc7zMVbOdPadxmVJelTchtE7zSNGFVAnz44iDx70IW8L4GPG4yft g==; X-IronPort-AV: E=McAfee;i="6400,9594,10359"; a="274285704" X-IronPort-AV: E=Sophos;i="5.91,252,1647327600"; d="scan'208";a="274285704" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2022 13:39:40 -0700 X-IronPort-AV: E=Sophos;i="5.91,252,1647327600"; d="scan'208";a="643060892" Received: from tjeziers-mobl1.amr.corp.intel.com (HELO [10.251.23.34]) ([10.251.23.34]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2022 13:39:39 -0700 Message-ID: Date: Thu, 26 May 2022 13:39:37 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCHv3 3/3] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page Content-Language: en-US To: "Kirill A. Shutemov" Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, luto@kernel.org, peterz@infradead.org, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, sathyanarayanan.kuppuswamy@linux.intel.com, seanjc@google.com, thomas.lendacky@amd.com, x86@kernel.org References: <20220524221012.62332-1-kirill.shutemov@linux.intel.com> <20220524221012.62332-4-kirill.shutemov@linux.intel.com> <6350b927-4b3f-6f43-aa62-f8db19fa8d5b@intel.com> <20220526203619.gpyyl67ygk622e5g@black.fi.intel.com> From: Dave Hansen In-Reply-To: <20220526203619.gpyyl67ygk622e5g@black.fi.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5/26/22 13:36, Kirill A. Shutemov wrote: > On Thu, May 26, 2022 at 09:20:56AM -0700, Dave Hansen wrote: >> On 5/24/22 15:10, Kirill A. Shutemov wrote: >>> + /* >>> + * MMIO accesses suppose to be naturally aligned and therefore never >>> + * cross a page boundary. Seeing unaligned accesses indicates a bug or >>> + * load_unaligned_zeropad() that steps into unmapped shared page. >> Wait a sec though... >> >> We've been talking all along about how MMIO accesses are in some cases >> just plain old compiler-generated memory accesses. It's *probably* bad >> code that does this, but it's not necessarily a bug. > Compiler-generated memory accesses tend to be aligned too. You need to do > something make them unalinged, like __packed or pointer trickery. I totally agree. But, the point is that __packed or pointer trickery is goofy, but it's not necessarily a bug. This might crash the kernel on goofy stuff, not bugs.