Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp575197pxf; Wed, 24 Mar 2021 10:40:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqqRX7mEANQrs7e1W/RgzNP8qnSrFaRfWNniCOTw5LrA1O0uMYShvxei7mncHuRyCz1lU8 X-Received: by 2002:a05:6402:440d:: with SMTP id y13mr4792774eda.316.1616607659611; Wed, 24 Mar 2021 10:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616607659; cv=none; d=google.com; s=arc-20160816; b=WYbQwi/nLdlF4jLPQSJ3SSBsDCck75j7KKUo78Et5hlY04pXsvkONerRvEqk5RjvMj ImVK4UxLOYFN9Aeexz/bczPyR+cSxd/3L7d9O+3IsVZKHJtkhvMzlaShIIwvYeBz/3xN dg1PzLllRD8TNl/k0U8M5nkzjemSJoz8anKdCiKcbaELpage0TyF5p+0OX3Md82++1iO 1ky2aUL459J6XsxQzI0la7qE0QplZwEEtoaoCY/5T9viJ5G910qPBYXCGMkNFp01u3pj cA10a4BLXM6y8LcCZBcgH8MfNKaYDm12l1mlhpV9BmgntjXW9a5mLX+ruVwLv0JeJ4DY 6peA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i0jVAPdV4uMZGW+9DRVmj8zwB+KQ4zU198TE5YQBbdo=; b=XclhcUZRVY/kc14gTflwsre6ZDFKzH+mAC9UfjhWh1ANPSBeoJgYm/MAgPSMEyQziS Js1NDQEu1eO66vMyPH3I0KZCRsaA3fqt0kaBE4URk2acFzIf6Lswqq84ad+u2WTM7TVc mjmLdIyQySkT4eFr5VJRw8DwpIrCfwR9uvTURn42DruqGKnEVZttoav4Zzd1E/woy+SP Apja8+zKxbUzUm6EoA0FTIJPY8I71x37uyCOc1sDBxidqu+TPopaZG2/B4rCE1ET1wMu oxrPu97VkjkTL0rLq+18KG7Opb/J1KHaRVIXpmnfpQKlrQmN5/t6F4M6MFpSUGP2n+kd pKTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=JsiMrqpz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si2202957edq.59.2021.03.24.10.40.36; Wed, 24 Mar 2021 10:40:59 -0700 (PDT) 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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=JsiMrqpz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236526AbhCXRj0 (ORCPT + 99 others); Wed, 24 Mar 2021 13:39:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:10606 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237047AbhCXRjA (ORCPT ); Wed, 24 Mar 2021 13:39:00 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12OHWWeq097863; Wed, 24 Mar 2021 13:38:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pp1; bh=i0jVAPdV4uMZGW+9DRVmj8zwB+KQ4zU198TE5YQBbdo=; b=JsiMrqpzRtiRzTYFDhNpMa6FvYzaladPqSoxMoB67y2q8HeP6fXSzhFHJf2lUa/cGN4O e51qsqXQyS6E43YrVbVFL+EyEkOfbSqeoJj/DE4ePh+R7hhdxDNaeumY8gU0Zl7LsF1P RKtxqWBq+k+efPDBx8qgfiID2xWVZ6HIEPjO66fc3wf6zraDvF41S2ENRJghWgBPV7rN rh03bGzjDUtKmu890wLoSvk3gvqfFdTETHz8nkHTxQxdDLOWIMVt1VjJbR2RzPgKxB2O QFWIZTcXrl4Uw8Q2kOZlWaiXSKzer5zx785K/kUhDaq7oYBrV5GAflChxew3kuFqmdjB zA== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 37g9cs161f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Mar 2021 13:38:57 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12OHREki030541; Wed, 24 Mar 2021 17:38:55 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 37d99rck3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Mar 2021 17:38:54 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12OHcYxB13369834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Mar 2021 17:38:34 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D0F54C052; Wed, 24 Mar 2021 17:38:52 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F69F4C04E; Wed, 24 Mar 2021 17:38:51 +0000 (GMT) Received: from localhost (unknown [9.171.93.123]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 24 Mar 2021 17:38:51 +0000 (GMT) Date: Wed, 24 Mar 2021 18:38:50 +0100 From: Vasily Gorbik To: Andy Lutomirski Cc: Sven Schnelle , X86 ML , linux-arch , Mark Rutland , LKML , Heiko Carstens , Christian Borntraeger Subject: Re: Is s390's new generic-using syscall code actually correct? Message-ID: References: Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-24_13:2021-03-24,2021-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103240127 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Sat, Mar 20, 2021 at 08:48:34PM -0700, Andy Lutomirski wrote: > Hi all- > > I'm working on my kentry patchset, and I encountered: > > commit 56e62a73702836017564eaacd5212e4d0fa1c01d > Author: Sven Schnelle > Date: Sat Nov 21 11:14:56 2020 +0100 > > s390: convert to generic entry > > As part of this work, I was cleaning up the generic syscall helpers, > and I encountered the goodies in do_syscall() and __do_syscall(). > > I'm trying to wrap my head around the current code, and I'm rather confused. > > 1. syscall_exit_to_user_mode_work() does *all* the exit work, not just > the syscall exit work. So a do_syscall() that gets called twice will > do the loopy part of the exit work (e.g. signal handling) twice. Is > this intentional? If so, why? > > 2. I don't understand how this PIF_SYSCALL_RESTART thing is supposed > to work. Looking at the code in Linus' tree, if a signal is pending > and a syscall returns -ERESTARTSYS, the syscall will return back to > do_syscall(). The work (as in (1)) gets run, calling do_signal(), > which will notice -ERESTARTSYS and set PIF_SYSCALL_RESTART. > Presumably it will also push the signal frame onto the stack and aim > the return address at the svc instruction mentioned in the commit > message from "s390: convert to generic entry". Then __do_syscall() > will turn interrupts back on and loop right back into do_syscall(). > That seems incorrect. > > Can you enlighten me? My WIP tree is here: > https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/log/?h=x86/kentry > For all the details to that change we'd have to wait for Sven, who is back next week. > Here are my changes to s390, and I don't think they're really correct: > > > https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/diff/arch/s390/kernel/syscall.c?h=x86/kentry&id=58a459922be0fb8e0f17aeaebcb0ac8d0575a62c Couple of things: syscall_exit_to_user_mode_prepare is static, and there is another code path in arch/s390/kernel/traps.c using enter_from_user_mode/exit_to_user_mode. Anyhow I gave your branch a spin and got few new failures on strace test suite, in particular on restart_syscall test. I'll try to find time to look into details.