Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3677622rdh; Thu, 28 Sep 2023 21:34:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgpF+8BT87PCklUjz9LxB56sSHTXvK+61qS6Voo/89cPjJ3/sxEg1ZQl99HgIzoErtHFuv X-Received: by 2002:aca:220e:0:b0:3a1:bfda:c6d2 with SMTP id b14-20020aca220e000000b003a1bfdac6d2mr2990350oic.11.1695962057007; Thu, 28 Sep 2023 21:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695962056; cv=none; d=google.com; s=arc-20160816; b=lgD7kYpNTo9J4Qms/BHU+Xw+EaOyHhH+1KS6uoicsz8Ss7sX2P48lCtz0kQeAlXYM9 YOqbo5N74yQVcSYzPGt/zqU8+1VnSF/wO01tw5/4KWxj7LW7nZgGdmSjd9EZT+PAaLYm KiKN2gRLU3Ch9xCBJB2n9uhDESG6dbm6bQwjY1uPcQ5iH2VnLWYhPYcl6jrlwiq4huuK EGmVjBEAu/gnsupn09mQrRKgfI0HQ3/hK1igaz2DqlHpc/4At7iWB29ykAhiBCcbzcdY hncWgmJus8GUlxgzTGfz2CQQEkTI6E/YLOtRLr4057R3KUfFLjiKeio2//AV+mNxKZH7 MUkA== 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:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=IoOMdWsqx13KyfLDmhd8kwn+FZuK3U7Zd1iwFOjjXP0=; fh=vAt+T3h7jKv47MXxCTf+yQqj0wySHMLBSesyjEW8wkg=; b=o6DD8ZBbCCHx778d3PKEdqiGPh0t5QkLBgqBZJQxmFbNNJ/FD7xww04XhkicQ90O+I 6V48tyDFVktnDbKAthtwuFuey5HlMCNDAaOt6tuJrkNdLhUi/0y9m3OVjjDyoNqI0D4o zuprfoySc62kxf3dv/5aB0MkSF6wQ99epcJHDuzOrR3tBP9fgVfmv7lsIyCmpSdT4Lto EyQcPTLZNmIkRb47psmL88xb9JZGqic5oTwEFnWnb8KL+ixgTAgv9xG4I9BFSPgCEap/ Ii8L3ymDxAlcjPcAux6Qw4aVJ+v24eK5/CqT2bkzPZ7DKWGxmmXdDP0MQxR4vLF5PZOy n1hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IqJxie0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id w63-20020a638242000000b005859e8c7c22si835215pgd.658.2023.09.28.21.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 21:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IqJxie0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 396BB83FF762; Thu, 28 Sep 2023 10:16:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231653AbjI1RPd (ORCPT + 99 others); Thu, 28 Sep 2023 13:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbjI1RPb (ORCPT ); Thu, 28 Sep 2023 13:15:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C5991A7 for ; Thu, 28 Sep 2023 10:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695921279; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IoOMdWsqx13KyfLDmhd8kwn+FZuK3U7Zd1iwFOjjXP0=; b=IqJxie0C2PYnojl6KJqT/K1pUvAykASHFbzvV17yMBYfbc8ZAVvT43wTSaqpgyFOV7G7hL AvhfTfGZN/D0nYZ7ApiF5LERMhHniObphVC/6XDeAzwNV4XQ6oABbRC6yKOEXUk4NSts2w YZ2GrBh10eihKdn/Mb2KbK4rF/QsJ30= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-205-jat8FW8XO5mtTgxvQOb2OQ-1; Thu, 28 Sep 2023 13:14:38 -0400 X-MC-Unique: jat8FW8XO5mtTgxvQOb2OQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-30e3ee8a42eso9828804f8f.1 for ; Thu, 28 Sep 2023 10:14:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695921277; x=1696526077; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IoOMdWsqx13KyfLDmhd8kwn+FZuK3U7Zd1iwFOjjXP0=; b=dOFixol+Sa3ZKYxm5WISzHEEy0bRsdFW6uREV6yjPmNGyvHRGukNO1Rxt5nWtMXhYO U+Ub0+4XRpICBy+QkqVumHCCWzwdtYCXuZThhHTK8urCb2uX4WUHX0HSzKcsvRllO/0G TdnCGMQlC1SCXIf+Kf0mJYcT4yx9/wY96YeU9xzanmjGFj3qLlpF2xzzLO2h1oAPLJi9 zZfND+Lzkym4onoTvJsvUnFOnL2qnNKdQ8RLCt0xQ1Qyif+hUZzKV3JH+a1AbM0NEOhb hhY6PGY2MZB/lE7mz16yy1zw89MB4N8sgb6C62panP2KWkJ020DGf58O61gQufxg0IK1 l+Ug== X-Gm-Message-State: AOJu0YxMvTT7Me49Szi1XKzdCgj1A7Jco025zDJYV+mOUS6ahMqTqN1z ki/sbSQdsmGeKEDn7LAWfWbvlnkY6xPlGleGXeu7R0ZqKjcOfX3lYw8mhiNQOVeaQc4q5zXvwyu cOl6d2RGOxWbXcaHEonO6Ru0OwD57hhX3 X-Received: by 2002:a5d:4d45:0:b0:31f:fcee:afcf with SMTP id a5-20020a5d4d45000000b0031ffceeafcfmr1675100wru.71.1695921276844; Thu, 28 Sep 2023 10:14:36 -0700 (PDT) X-Received: by 2002:a5d:4d45:0:b0:31f:fcee:afcf with SMTP id a5-20020a5d4d45000000b0031ffceeafcfmr1675065wru.71.1695921276488; Thu, 28 Sep 2023 10:14:36 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id e21-20020a056402149500b005256d80cdaesm9954826edv.65.2023.09.28.10.14.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 10:14:35 -0700 (PDT) Message-ID: Date: Thu, 28 Sep 2023 19:14:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Sean Christopherson , Isaku Yamahata Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Michael Roth , erdemaktas@google.com, Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, linux-coco@lists.linux.dev, Chao Peng , Ackerley Tng , Vishal Annapurve , Yuan Yao , Jarkko Sakkinen , Xu Yilun , Quentin Perret , wei.w.wang@intel.com, Fuad Tabba References: <20230922194029.GA1206715@ls.amr.corp.intel.com> From: Paolo Bonzini Subject: Re: [RFC PATCH v2 0/6] KVM: gmem: Implement test cases for error_remove_page In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 28 Sep 2023 10:16:09 -0700 (PDT) On 9/22/23 22:32, Sean Christopherson wrote: > Unless we can't extend fadvise() for some reason, I think we should pursue > FADV_HWPOISION. The enabling should be downright trivial, e.g. just implement > file_operations.fadvise() for guest_memfd, have it handle FADV_HWPOISON, and pass > everything else to generic_fadvise(). > > It'll basically be your ioctl() just without a dedicated ioctl(). > > At the very least, we should run the idea past the fs maintainers. fadvise() is different from madvise() though and not necessarily a great match. Looking at the list of flags in advise(), something like FADV_POPULATE_READ, FADV_PAGEOUT or FADV_COLD would make sense, but I can't really think of any other flag that would be useful in a general case for fadvise. Everything else would have to be very spcific to memfd or guest_memfd. In particular FADV_HWPOISON would not make sense for anything that is not backend by memory. There are some flags that could be useful on gmem file descriptors, such as hypothetically {WIPE,KEEP}ONFORK or SOFT_OFFLINE, but again they're not something that can be applied to fadvise(). So a ioctl implementation does have some advantages after all. I suggest that we reuse MADV_* flags in the ioctl arguments, to leave the door open for future extensions and avoid ioctl proliferation. The ioctl could be implemented by memfd, too, and perhaps even by /dev/zero. Paolo