From patchwork Mon Jun 29 21:48:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David CARLIER X-Patchwork-Id: 11632943 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B1A0174A for ; Tue, 30 Jun 2020 00:43:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E6E1020786 for ; Tue, 30 Jun 2020 00:43:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eKPrl9Fd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6E1020786 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jq4MY-0008TP-5q for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Jun 2020 20:43:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jq1dh-0007MY-3A; Mon, 29 Jun 2020 17:48:33 -0400 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]:41237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jq1dc-000854-Ts; Mon, 29 Jun 2020 17:48:32 -0400 Received: by mail-ed1-x542.google.com with SMTP id e22so14297854edq.8; Mon, 29 Jun 2020 14:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=O++SecfjGgP0FVmkVuIgRRw4l8+URq7SlnZnl9/xoSE=; b=eKPrl9FdtW/4zEJsY8c9E5+z7T86IhhMOtEVLMFcRNn7XGkWMdoyQgxZ4CH0IwY6Au qsYSEZBslUx/W3u9z2c3SlQUGaw8ftYHa3vMONuvV6XbkgEpH4v2fZp418SzferHgyCZ vkQUywaV9VNziXucPjct6zBsNKE3CxvXN2FHQB0mt8DrslkatLV7+yUqLFroZ/2Fs3py b/tXtCuAH59Depq9hQCvaf/CPtWSl0LdKKxfug8XL7OnVhqOT307WLsD4+QmtMIYoqpD tFT4j3HOc9ck+woNI6w1INZmhLkPl7xAriivcU2ROECfn8dlwooDWlpiLWp9H3DTtN+I EBUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=O++SecfjGgP0FVmkVuIgRRw4l8+URq7SlnZnl9/xoSE=; b=DN2VNt/lO+zBKWbQg5e9/gag8BXMUUubnrpvv6EsJiontQIPUGYpK2i9C9uEeJUzWb 9yjO8H/ad96valCqw3gPlquj1JxftGMRI61chPdrr6ahDHaJ6DsOGzTuH9rFm3shkCVz /PO3gkZrxX4q6462Aals6tLG9anMV/DZqun8Xso/O4DptsldS25/4sBhdoL22Bv75W4d rIzlTmQYgaQ/N9IhYlZo92Fibh+N+8/wklvinWmVGduZaEMs+q72rJMDqOe1NZNEd0Tw 5GpfIdaZSR+PfMXL1NAu9GS3HWox1f4/3KwQotW43Ah+AmmglXx4FE2hQD2yHBH2cyfK mQdA== X-Gm-Message-State: AOAM533sJtyariq1838YKYHXmiknc7EeF37NezjU989tkKzGvU/4wA+d wlQj+S36dwGaxr68f8acQ+ZRtUGDvKFYUgr6ObbZD2JZKH0= X-Google-Smtp-Source: ABdhPJx7oEFhUHiJAXHzke6le3FXwH20oBHk0lnmQpenLELY6DL8X4xSK6NgXZhGyNueJForn2CmzqfLrerjAEz4IE4= X-Received: by 2002:a05:6402:3049:: with SMTP id bu9mr5818559edb.232.1593467307086; Mon, 29 Jun 2020 14:48:27 -0700 (PDT) MIME-Version: 1.0 From: David CARLIER Date: Mon, 29 Jun 2020 22:48:16 +0100 Message-ID: Subject: [PATCH 3/9] Checking mlockall symbol presence To: QEMU Trivial , qemu-devel Received-SPF: pass client-ip=2a00:1450:4864:20::542; envelope-from=devnexen@gmail.com; helo=mail-ed1-x542.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Mon, 29 Jun 2020 20:42:18 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From ac450c4abe03e0e461fede18727500e616d9f7e2 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 29 Jun 2020 22:15:21 +0000 Subject: [PATCH 3/9] Checking mlockall symbol presence. Signed-off-by: David Carlier Reviewed-by: Peter Maydell --- configure | 15 +++++++++++++++ os-posix.c | 4 ++++ 2 files changed, 19 insertions(+) -- 2.26.0 diff --git a/configure b/configure index 50b559238f..0b278f1646 100755 --- a/configure +++ b/configure @@ -2392,6 +2392,18 @@ else pty_h=no fi +cat > $TMPC < +int main(int argc, char *argv[]) { + return mlockall(MCL_FUTURE); +} +EOF +if compile_prog "" "" ; then + have_mlockall=yes +else + have_mlockall=no +fi + ######################################### # vhost interdependencies and host support @@ -7865,6 +7877,9 @@ fi if test "$pty_h" = "yes" ; then echo "CONFIG_PTY=y" >> $config_host_mak fi +if test "$have_mlockall" = "yes" ; then + echo "CONFIG_MLOCKALL=y" >> $config_host_mak +fi if test "$fuzzing" = "yes" ; then if test "$have_fuzzer" = "yes"; then FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" diff --git a/os-posix.c b/os-posix.c index 3cd52e1e70..e02b566940 100644 --- a/os-posix.c +++ b/os-posix.c @@ -337,6 +337,7 @@ bool is_daemonized(void) int os_mlock(void) { +#if defined CONFIG_MLOCKALL int ret = 0; ret = mlockall(MCL_CURRENT | MCL_FUTURE); @@ -345,4 +346,7 @@ int os_mlock(void) } return ret; +#else + return -ENOSYS; +#endif }