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 16632C4332F for ; Mon, 19 Dec 2022 10:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231694AbiLSKRi (ORCPT ); Mon, 19 Dec 2022 05:17:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231545AbiLSKR3 (ORCPT ); Mon, 19 Dec 2022 05:17:29 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FCF2DFD; Mon, 19 Dec 2022 02:17:27 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 241F21EC0662; Mon, 19 Dec 2022 11:17:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1671445046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Td6DN6d9KHuO8Ni0x4sFSPaN76BIetZ9amTLwGfBuQY=; b=Gi31BrcudDAIpa+PJzR9Rm2IwbH2EvgIUujPE8wya8WJCeKy/2ekrtTK9r05L2S9b69Vty nPxnhxFIIyGflDiLpYzFN3KhRz/d2AlJ8y/q4NmLiN36+iptFsaIT87iBVCGpQcQ6JiTDL XdJKVV4+vR907NBBpfad61/X4A6kZl0= Date: Mon, 19 Dec 2022 11:17:22 +0100 From: Borislav Petkov To: Chao Peng Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Arnd Bergmann , Naoya Horiguchi , Miaohe Lin , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , tabba@google.com, Michael Roth , mhocko@suse.com, wei.w.wang@intel.com Subject: Re: [PATCH v10 2/9] KVM: Introduce per-page memory attributes Message-ID: References: <20221202061347.1070246-1-chao.p.peng@linux.intel.com> <20221202061347.1070246-3-chao.p.peng@linux.intel.com> <20221219081532.GD1691829@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221219081532.GD1691829@chaop.bj.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 19, 2022 at 04:15:32PM +0800, Chao Peng wrote: > Tamping down with error number a bit: > > if (attrs->flags) > return -ENXIO; > if (attrs->attributes & ~supported_attrs) > return -EOPNOTSUPP; > if (!PAGE_ALIGNED(attrs->address) || !PAGE_ALIGNED(attrs->size) || > attrs->size == 0) > return -EINVAL; > if (attrs->address + attrs->size < attrs->address) > return -E2BIG; Yap, better. I guess you should add those to the documentation of the ioctl too so that people can find out why it fails. Or, well, they can look at the code directly too but still... imagine some blurb about user-friendliness here... :-) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette