Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp99722imm; Thu, 13 Sep 2018 16:31:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbkVtHTOC36UocqO3MrosA8k3gQz4PNz13+1KoxfCXMvryGNbNq2OUFPSCiVs4pn31oWh59 X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr9498777pfn.77.1536881490567; Thu, 13 Sep 2018 16:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536881490; cv=none; d=google.com; s=arc-20160816; b=VAvHTMs8P8oObGIbjRzdq64i7epPKP2YUyiFzbR6WmTSbJLKEuemE37dPmVLkftYx5 ROdvcP+7hnLk6kYsmZ6plUtaq7FrvegvZ9djRsRsM+jfgYRgUaqphEuQb2ylfDtTgct2 yBzpMWBWUNqsO1YIzsLZtRsqNdA/2aHH9O7Xc1d3/no8DzrgUuMHH5SvjrXHkS+d4yAu IOv4PkD9QE7EOgf1577tWpjhqkzTAGAcxhZ//0j3DLZjdQCB5zdm0DfbPv/OcXe6X72u e5dgGRZygCpUxq4dYJ8QMQzBZO6xIdF2K00p6z8U35EDwzTdncJTosXis8DV1NgE/XfJ bakA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=FPgb5+dOt//UHvKK759z9x+MNgUfAToKaKysiya4+Hc=; b=HlHcfbIBujr1jV/J8PvsnTHz1v/WIlnyJ/lrqWKNcJDDdlo8wCJvf6QXz730KugYHo J5kAuX432ZJUds+ZoMJXhkMqevaQlyQvzrQIQ2nSlQtGzRqIBI4ntFsrNusfESUSzcqR yUWYBrN0OFrdU1vk4/KbavP34NNJQFY/tTsIVLxKloY7gvvaXuzYcB9qfj0QloT+Dcbx wy7xKyTGrmTUNc2a/WfEpyagbsFl5JGg/LmNiELpPesMBfXad5Zhcxd4J+jFOQO7XjSK L1MBzdKfGCNrEHTdtRmpcNfFWOBj/09l2ttP6UT+HFRic+4BEAVtoZ5xWmmcPhq6YVn5 /hIA== ARC-Authentication-Results: i=1; mx.google.com; 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 r205-v6si5656505pgr.634.2018.09.13.16.31.14; Thu, 13 Sep 2018 16:31:30 -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; 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 S1726894AbeINEms (ORCPT + 99 others); Fri, 14 Sep 2018 00:42:48 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:46635 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbeINEmr (ORCPT ); Fri, 14 Sep 2018 00:42:47 -0400 Received: from p4fea45ac.dip0.t-ipconnect.de ([79.234.69.172] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1g0b4j-0003Ix-IM; Fri, 14 Sep 2018 01:31:05 +0200 Date: Fri, 14 Sep 2018 01:31:05 +0200 (CEST) From: Thomas Gleixner To: Brijesh Singh cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Tom Lendacky , Borislav Petkov , "H. Peter Anvin" , Paolo Bonzini , Sean Christopherson , =?ISO-8859-2?Q?Radim_Kr=E8m=E1=F8?= Subject: Re: [PATCH v8 2/2] x86/kvm: use __bss_decrypted attribute in shared variables In-Reply-To: <1536875471-17391-3-git-send-email-brijesh.singh@amd.com> Message-ID: References: <1536875471-17391-1-git-send-email-brijesh.singh@amd.com> <1536875471-17391-3-git-send-email-brijesh.singh@amd.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 13 Sep 2018, Brijesh Singh wrote: > > +static void __init kvmclock_init_mem(void) > +{ > + unsigned int ncpus = num_possible_cpus() - HVC_BOOT_ARRAY_SIZE; > + unsigned int order = get_order(ncpus * sizeof(*hvclock_mem)); > + struct page *p; > + int r; > + > + p = alloc_pages(GFP_KERNEL, order); > + if (p) { If you make this: if (!p) { pr_warn(); return; } then you spare one indentation level and give useful information. > + hvclock_mem = page_address(p); > + > + /* > + * hvclock is shared between the guest and the hypervisor, must > + * be mapped decrypted. > + */ > + if (sev_active()) { > + r = set_memory_decrypted((unsigned long) hvclock_mem, > + 1UL << order); > + if (r) { > + __free_pages(p, order); > + hvclock_mem = NULL; This wants a pr_warn() as well, please. > + return; > + } > + } > + > + memset(hvclock_mem, 0, PAGE_SIZE << order); > + } > +} Other than that, this looks really reasonable and way more palatable in the rc stage. Thanks, tglx