Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2970484pxb; Fri, 12 Feb 2021 06:15:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzV8L6pZs/IgvqMsWL24cvYv7zYyTrS9u/b8DAF+PXfc4MZQAUC1V2NLWfRV9FUfpmuV44l X-Received: by 2002:a05:6402:26d5:: with SMTP id x21mr3621596edd.50.1613139331045; Fri, 12 Feb 2021 06:15:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613139331; cv=none; d=google.com; s=arc-20160816; b=W0Hl7PMdoRxo3DmqQeALjmstr7cHE9CdjyZdFekUxhvzKig8InjzbOH4DlU0c5103s ZR8pKTIsUDP2FmVUux6JfMn+kW/F615fB4JSsDATw8Sr+wNLT10EktfWBgQyI1tCblyH CgHvPpjsrDplK0ixgjS39g4gaVMZRp2rwxWuwEMdJGbpUH5wPIc6fEcDQRDpwrYjmb+Z 74ZwesgOCISZC9SEBgE0mWWKIYapnKVhyseFgEG24/Oe95h8Moni1eTUeu44CFBIGaxE /JTRiKzZBfPXmdcPLWjhA4i7/9KiuPYJU6QXC9JDgAUuTLznH0ZtNVMeA918ZBD7zUyz DRWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=6OoANvBjeo67/Nzt3OIbxwvKfy7Syk3NY3LA3c1Y/Kg=; b=t0oqhdJg/lgOPDVqunvtHz4FW3wlr2OdcH61jdTbIim9H7FzLJeG7+YJQBkVmvwxsU sBinYcs0bXEeh5Sd3XCoRAvDthEl5DMcAZSTYhUK/PU8U5/8umkMATlnPoDr3qiOqFD7 lqv6PYsDsFECwVbpjopF67GGXXvHq/Chjo2GXJ4GctDz6hVzeBYLQ1mdlBe4MIzhGq8y 4zn9unN9XXm4QBC0mLHHyQF1lllm2ntceGBOimGAcJzhYYMBUMRJ1LdC7eGzG3qzR+GI xI9axEN44rMB2+U0fJHL9X8UMIrwEfv8QBfuc58hFtpGBbqsRkYwktPqM2pRGreYFPea NTcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si1130242eds.59.2021.02.12.06.15.07; Fri, 12 Feb 2021 06:15:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231768AbhBLOOW convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 Feb 2021 09:14:22 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:23048 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbhBLONs (ORCPT ); Fri, 12 Feb 2021 09:13:48 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-228-7juo4BU-O2-FOsFv4E1WeQ-1; Fri, 12 Feb 2021 14:12:05 +0000 X-MC-Unique: 7juo4BU-O2-FOsFv4E1WeQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 12 Feb 2021 14:12:02 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 12 Feb 2021 14:12:02 +0000 From: David Laight To: 'Catalin Marinas' , Mark Brown CC: Steven Price , "sonicadvance1@gmail.com" , "amanieu@gmail.com" , "Will Deacon" , Mark Rutland , Oleg Nesterov , Al Viro , Dave Martin , Amit Daniel Kachhap , "Marc Zyngier" , David Brazdil , Jean-Philippe Brucker , Andrew Morton , Anshuman Khandual , Gavin Shan , Mike Rapoport , "Vincenzo Frascino" , Kristina Martsenko , Kees Cook , "Sami Tolvanen" , Frederic Weisbecker , Kevin Hao , Jason Yan , Andrey Ignatov , Peter Collingbourne , Julien Grall , Tian Tao , Qais Yousef , Jens Axboe , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [RESEND RFC PATCH v2] arm64: Exposes support for 32-bit syscalls Thread-Topic: [RESEND RFC PATCH v2] arm64: Exposes support for 32-bit syscalls Thread-Index: AQHXAUNInwWNlJur40qqyYPDj4lGvapUi6pA Date: Fri, 12 Feb 2021 14:12:02 +0000 Message-ID: <7300c3cbce95498b9fbe7ee754250794@AcuMS.aculab.com> References: <20210211202208.31555-1-Sonicadvance1@gmail.com> <58b03e17-3729-99ea-8691-0d735a53b9bc@arm.com> <20210212123515.GC6057@sirena.org.uk> <20210212132807.GC7718@arm.com> In-Reply-To: <20210212132807.GC7718@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Catalin Marinas > Sent: 12 February 2021 13:28 > > On Fri, Feb 12, 2021 at 12:35:15PM +0000, Mark Brown wrote: > > On Fri, Feb 12, 2021 at 11:30:41AM +0000, Steven Price wrote: > > > On 11/02/2021 20:21, sonicadvance1@gmail.com wrote: > > > > Why do we need compatibility layers? > > > > There are ARMv8 CPUs that only support AArch64 but still need to run > > > > AArch32 applications. > > > > Cortex-A34/R82 and other cores are prime examples of this. > > > > Additionally if a user is needing to run legacy 32-bit x86 software, it > > > > needs the same compatibility layer. > > > > > Unless I'm much mistaken QEMU's user mode already does this - admittedly I > > > don't tend to run "legacy 32-bit x86 software". > > > > Yes, this has been deployed on Debian for a long time - you can install > > any combination of Debian architectures on a single system and it will > > use qemu to run binaries that can't be supported natively by the > > hardware. > > The only downside I think is that for some syscalls it's not that > efficient. Those using struct iovec come to mind, qemu probably > duplicates the user structures, having to copy them in both directions > (well, the kernel compat layer does something similar). > > Anyway, I'm not in favour of this patch. Those binary translation tools > need to explore the user-only options first and come up with some perf > numbers to justify the proposal. I don't think the problem is only the performance. The difficulty is knowing when structures need changing. A typical example is driver ioctl requests. Any user space adaption layer would have to know which actual driver has been opened and what internal structures it has. Getting that right is hard and difficult. The recent changes to move (IIRC) sockopt compatibility down into the protocol code found quite a few places where it was previously broken. It is much easier to get it right in the code that knows about the actual structures. For mmap() you certainly want to be able to limit the returned address to 32 bits (or maybe 31.5 bits). A MAP_BELOW flag could do that, but the 32bit syscall has to. (I can't remember what is done for wine - which needs 31bit addresses). Of course, that only helps for 32bit arm binaries - when the kernel compat code is written for, Trying to run x86 binaries adds extra complexity. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)