Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4686059iob; Sun, 8 May 2022 22:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQH1FrVPU6djahQkwGmG6XjmlPuZtW9BucnJVD2h3d/Zbel+4XI5XbK+yxyjdZeowVg7a8 X-Received: by 2002:a17:90a:4897:b0:1c7:5fce:cbcd with SMTP id b23-20020a17090a489700b001c75fcecbcdmr24500686pjh.45.1652072405118; Sun, 08 May 2022 22:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652072405; cv=none; d=google.com; s=arc-20160816; b=AO/aoTont3T++AktfZE+j/9Ewb+C9r/SOYQo5+DyG639kPYbgXHUPxokry8neOk4kx lFgWBphvWckggPD5dBeHsY1WasS3P301MxdAE7D9cBMFY2dg+WGPsf4xaTUi//oHClHM CcmjeVupJ6lEOVToKUcxmYApdWJmhaBBygsv5pOcQwVR/PMqQwOnQpotPY3rYbSCsWEF exfzdeFhezHCc8vrEEvkltXKB5BuHp70p3IsC2oxLZEks5ZiHj120zmjXdENZLk9WBPw FslZ5XLWGAMRNYK2y4kiHY0byhm41+r3u0CWM/rb45Bo26SH8mfS48u1kTY54mEubvVw JzRA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=bRmWHothJ44idqRxRc2b4VvG+NnDl/cNT8TjtLNF0oA=; b=Ocou3teiSVnIkqc8hBaqeqcwoAc4SZDqXLaGG8MrP6C+fy9LZIfMSkPnQocXVFqYmm b35Ez+YruBJ251eAhqtLtufBWyRInP+47V7Kxa1qvyV7HyfpZAH7Y6TupAtdRNEgZdtC XFG0b4+AReCu8y2aBA7TEdbU0Oy71hUaTwCqqbPViVY1+2oGYpePpWWWeO33hqi8ZTMl RkHnFYe+3FUORaJ/kkrlgmIhScKmidj18am5n5H+BxVMohs1vkKMR03vEIGGZqqNqGS+ wVLkPj51xwNUT9bQAwIt9Jpb82v31HpFR9FdADF9syPDQH72g913JljfT5Ba+KgO10pt +ECw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qj1uWR9h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t63-20020a638142000000b003c19e2b283esi12187802pgd.494.2022.05.08.22.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qj1uWR9h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 185E05DE79; Sun, 8 May 2022 21:56:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443297AbiEFQEj (ORCPT + 99 others); Fri, 6 May 2022 12:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392246AbiEFQEf (ORCPT ); Fri, 6 May 2022 12:04:35 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB624D636; Fri, 6 May 2022 09:00:49 -0700 (PDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 246FeEnw028532; Fri, 6 May 2022 16:00:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=bRmWHothJ44idqRxRc2b4VvG+NnDl/cNT8TjtLNF0oA=; b=qj1uWR9hKfdHIXUpYuovn0sRaVNrm0WqBoQwyDIBr9xYlP46hgM9ZrPKbjxUysPrV2p0 NZ9z5uQ0KdeTKyvr5SduHtYvEJx0DodtNVtjtkkQdA0wUAR4uwq2FjkllkX14b01EyiF T+sP4EAKOwo9XMebeVwbQ6Xz6jrSiYhmWsOPRUVbVeOUW27erfz+NPs3JYWU6m4Cf+DQ Fns15BFUbiWlvFi4T4zjU4rJgxmJh410mde+wLJbZl9/niOjaQyJmrTsSD8/cfI8CWVA TPzkvaYqChyU7HrN1oOy+Srj36LNDs/lKTb0Lwq5ppsnHOA+edwOyuwzpraMyw0WP+21 Sw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3fw5b4a1kh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 May 2022 16:00:44 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 246FxA5I007140; Fri, 6 May 2022 16:00:43 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3fw5b4a1k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 May 2022 16:00:43 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 246FeR5F018164; Fri, 6 May 2022 15:55:39 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma04dal.us.ibm.com with ESMTP id 3frvrabh39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 May 2022 15:55:39 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 246FtcBB34800094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 May 2022 15:55:38 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A5AB78060; Fri, 6 May 2022 15:55:38 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 080DA7805F; Fri, 6 May 2022 15:55:36 +0000 (GMT) Received: from [9.211.41.182] (unknown [9.211.41.182]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 6 May 2022 15:55:35 +0000 (GMT) Message-ID: <6e3f4d81-dcb5-9a64-a9f8-2c9b319574ef@linux.ibm.com> Date: Fri, 6 May 2022 11:55:35 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v6 14/21] KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding Content-Language: en-US To: Christian Borntraeger , linux-s390@vger.kernel.org Cc: alex.williamson@redhat.com, cohuck@redhat.com, schnelle@linux.ibm.com, farman@linux.ibm.com, pmorel@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com, frankja@linux.ibm.com, david@redhat.com, imbrenda@linux.ibm.com, vneethv@linux.ibm.com, oberpar@linux.ibm.com, freude@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, pbonzini@redhat.com, corbet@lwn.net, jgg@nvidia.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <20220426200842.98655-1-mjrosato@linux.ibm.com> <20220426200842.98655-15-mjrosato@linux.ibm.com> <28395b98-3489-342a-970a-5358e4405f22@linux.ibm.com> From: Matthew Rosato In-Reply-To: <28395b98-3489-342a-970a-5358e4405f22@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZYJdC1IPRRb3XJnAspOlOwIp7kSxSB3- X-Proofpoint-ORIG-GUID: 1Tvfo-boab2yO5F4ca5zEB0e4uWca6Lx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-06_04,2022-05-06_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 adultscore=0 phishscore=0 priorityscore=1501 impostorscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205060082 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/6/22 11:35 AM, Christian Borntraeger wrote: > > > Am 26.04.22 um 22:08 schrieb Matthew Rosato: > [...] >> +static inline void unaccount_mem(unsigned long nr_pages) >> +{ >> +    struct user_struct *user = get_uid(current_user()); >> + >> +    if (user) >> +        atomic_long_sub(nr_pages, &user->locked_vm); >> +    if (current->mm) >> +        atomic64_sub(nr_pages, ¤t->mm->pinned_vm); >> +} >> + >> +static inline int account_mem(unsigned long nr_pages) >> +{ >> +    struct user_struct *user = get_uid(current_user()); >> +    unsigned long page_limit, cur_pages, new_pages; >> + >> +    page_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; >> + >> +    do { >> +        cur_pages = atomic_long_read(&user->locked_vm); >> +        new_pages = cur_pages + nr_pages; >> +        if (new_pages > page_limit) >> +            return -ENOMEM; >> +    } while (atomic_long_cmpxchg(&user->locked_vm, cur_pages, >> +                    new_pages) != cur_pages); >> + >> +    atomic64_add(nr_pages, ¤t->mm->pinned_vm); >> + >> +    return 0; > > user->locked_vm is not available unconditionally. Shall we add > > CONFIG_S390 && CONFIG_KVM here? > > include/linux/sched/user.h > #if defined(CONFIG_PERF_EVENTS) || defined(CONFIG_BPF_SYSCALL) || \ >     defined(CONFIG_NET) || defined(CONFIG_IO_URING) >         atomic_long_t locked_vm; > #endif > Or we could get rid of the user memlock checking for now until this is > more ubiquitous. Oh, good catch. Per my conversation with Jason in a thread on patch 16, we will end up with a CONFIG_VFIO_PCI_ZDEV_KVM (or something like that) -- this could be used instead of CONFIG_S390 && CONFIG_KVM and would imply both of those anyway > > > Otherwise this looks sane > > Reviewed-by: Christian Borntraeger