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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD465C369B9 for ; Tue, 15 Apr 2025 07:29:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u4aj9-0004z3-MM; Tue, 15 Apr 2025 03:29:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u4aip-0004wU-HP; Tue, 15 Apr 2025 03:28:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u4ain-0004yb-8J; Tue, 15 Apr 2025 03:28:43 -0400 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 53F7PaVu026315; Tue, 15 Apr 2025 07:28:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=SLR+Nz nh26ODQzg5nNKe9b+mnT0+Vw2BPaWKvC11Vmc=; b=d9iFrUBkRUodUPesL92fsJ 0aRE8hA6syv7g7KwYfqjqh0e8ZWefHDOHC8hkK4AwijuS+K31bb+NiuHWk4XXyuz BmSDX8FJMpz9peZcK2c4RsgrmKyaNVNXIUTXKLYf6Mjb94iz7EajrNAiNeZeNZYu xXec4+lSOrtxCtSvokhKacAlyUzo1bPM/ZveebgvlGWG1Dxp05DqhKE4RVW2ZDQi zBtD37VDPbEaB551Lb3vfWCUjAyPHrWMf+pLgyTgsBeKph2D/IjixZUMi/9+B0Qz 6ksvVsWYVqPQjM96RyzczMqO0dajiGvCWxZoY29nN9SNXclE8Y6Yf6oa80xJsMNg == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 46109f57qw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Apr 2025 07:28:28 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 53F7OTfU004866; Tue, 15 Apr 2025 07:28:28 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 46109f57qt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Apr 2025 07:28:28 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 53F53S3G001265; Tue, 15 Apr 2025 07:28:26 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4602vyt4u0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Apr 2025 07:28:26 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 53F7SP0i15336036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Apr 2025 07:28:25 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60ED85805A; Tue, 15 Apr 2025 07:28:25 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E8F658051; Tue, 15 Apr 2025 07:28:22 +0000 (GMT) Received: from [9.171.59.120] (unknown [9.171.59.120]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 15 Apr 2025 07:28:22 +0000 (GMT) Message-ID: Subject: Re: [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x From: Niklas Schnelle To: Alex Williamson , Farhan Ali Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, fam@euphon.net, philmd@linaro.org, kwolf@redhat.com, hreitz@redhat.com, thuth@redhat.com, mjrosato@linux.ibm.com, =?ISO-8859-1?Q?C=E9dric?= Le Goater , venture@google.com, crauer@google.com, pefoley@google.com, david@redhat.com Date: Tue, 15 Apr 2025 09:28:21 +0200 In-Reply-To: <20250411162819.1526fb12.alex.williamson@redhat.com> References: <20250401172246.2688-1-alifm@linux.ibm.com> <20250402155152.GE304512@fedora> <2c11a602415f0780030d4e68a28eee7ffcdd8cb7.camel@linux.ibm.com> <20250403154442.GA349582@fedora> <20250403102704.7e1f4452.alex.williamson@redhat.com> <2c244588-b37b-4e86-863e-ef462343edad@linux.ibm.com> <20250403120504.2f660171.alex.williamson@redhat.com> <20250403152402.1373f0b2.alex.williamson@redhat.com> <20250411162819.1526fb12.alex.williamson@redhat.com> Autocrypt: addr=schnelle@linux.ibm.com; prefer-encrypt=mutual; keydata=mQINBGHm3M8BEAC+MIQkfoPIAKdjjk84OSQ8erd2OICj98+GdhMQpIjHXn/RJdCZLa58k /ay5x0xIHkWzx1JJOm4Lki7WEzRbYDexQEJP0xUia0U+4Yg7PJL4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x uaWtzQGtlcm5lbC5vcmc+iQJUBBMBCAA+AhsBBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEnbAA stJ1IDCl9y3cr+Q/FejCYJAFAmesuuEFCQenEYkACgkQr+Q/FejCYJC6yxAAiQQ5NAbWYKpkxxjP/ AajXheMUW8EtK7EMJEKxyemj40laEs0wz9owu8ZDfQl4SPqjjtcRzUW6vE6JvfEiyCLd8gUFXIDMS l2hzuNot3sEMlER9kyVIvemtV9r8Sw1NHvvCjxOMReBmrtg9ooeboFL6rUqbXHW+yb4GK+1z7dy+Q 9DMlkOmwHFDzqvsP7eGJN0xD8MGJmf0L5LkR9LBc+jR78L+2ZpKA6P4jL53rL8zO2mtNQkoUO+4J6 0YTknHtZrqX3SitKEmXE2Is0Efz8JaDRW41M43cE9b+VJnNXYCKFzjiqt/rnqrhLIYuoWCNzSJ49W vt4hxfqh/v2OUcQCIzuzcvHvASmt049ZyGmLvEz/+7vF/Y2080nOuzE2lcxXF1Qr0gAuI+wGoN4gG lSQz9pBrxISX9jQyt3ztXHmH7EHr1B5oPus3l/zkc2Ajf5bQ0SE7XMlo7Pl0Xa1mi6BX6I98CuvPK SA1sQPmo+1dQYCWmdQ+OIovHP9Nx8NP1RB2eELP5MoEW9eBXoiVQTsS6g6OD3rH7xIRxRmuu42Z5e 0EtzF51BjzRPWrKSq/mXIbl5nVW/wD+nJ7U7elW9BoJQVky03G0DhEF6fMJs08DGG3XoKw/CpGtMe 2V1z/FRotP5Fkf5VD3IQGtkxSnO/awtxjlhytigylgrZ4wDpSE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 2gRKfgoEuVHj1ZCfQh8nbN6KAFtGeZZ3 X-Proofpoint-ORIG-GUID: fUwjKS7_I2BHU--F-FsQuEjT_3zaBKhP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-15_03,2025-04-10_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504150046 Received-SPF: pass client-ip=148.163.156.1; envelope-from=schnelle@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Fri, 2025-04-11 at 16:28 -0600, Alex Williamson wrote: > > >=20 --- snip --- > > > Cc: folks related to that commit. > > >=20 > > > The original issue that brought us ram_device was a very obscure > > > alignment of a memory region versus a device quirk only seen with > > > assignment of specific RTL NICs. > > >=20 > > > The description for commit 4a2e242bbb30 ("memory: Don't use memcpy fo= r > > > ram_device regions") also addresses unaligned accesses, we don't expe= ct > > > drivers to use them and we don't want them to work differently in a V= M > > > than they might on bare metal. We can debate whether that's valid or > > > not, but that was the intent. > > >=20 > > > Have we re-introduced the chance that we're using optimized > > > instructions only meant to target RAM here or is __builtin_memcpy > > > implicitly safe for MMIO? Thanks, > > >=20 > > > Alex =20 > >=20 > >=20 > > Hi Stefan, Alex > >=20 > >=20 > > Polite ping. Following up to understand how we should proceed with this= =20 > > series. Please let me know if there are any concerns that i haven't=20 > > addressed? >=20 > I disassembled the current implementation using ldn_he_p/stn_he_p on > x86_64 and it doesn't appear to introduce any of the mmx/sse optimized > optimized code that we were trying to get away from in introducing the > ram_device MemoryRegion and getting away from memcpy. I wish I had > some assurance that __builtin_memcpy won't invoke such operations, but > it seems unlikely that it would for the discrete, fundamental size > operations we're asking of it. Therefore, maybe it is advisable to use > the ld*_he_p/st*_he_p helpers rather than open code the memory derefs. >=20 > It's unfortunate that s390x needs to specifically restrict this access > to PCI memory, but maybe that means that PCI specific version of these > helpers are only created for s390x and elsewhere #define'd to the > generic ld/st helpers, which maybe means the main interface should be a > host_pci_{ld,st}n_he_p (maybe "le" given the implementation) type > function. I don't know if we'd then create a ram_pci_device variant > memory region ops for use in vfio-pci, but it should probably be coded > with that in mind. Thanks, >=20 > Alex >=20 Hi Alex, Just as a clarification because it was unclear earlier in the thread. While it is true that the PCI instructions are restricted to PCI, there is also no other kind of MMIO on s390x. This might not really help here though because the PCI instructions can not be used to access main/normal memory. So it's really a distinction between normal memory and MMIO where MMIO would, if they were available, also include things like GPU VRAM. Thanks, Niklas