ttm_object.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2. /**************************************************************************
  3. *
  4. * Copyright (c) 2009-2023 VMware, Inc., Palo Alto, CA., USA
  5. * All Rights Reserved.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the
  9. * "Software"), to deal in the Software without restriction, including
  10. * without limitation the rights to use, copy, modify, merge, publish,
  11. * distribute, sub license, and/or sell copies of the Software, and to
  12. * permit persons to whom the Software is furnished to do so, subject to
  13. * the following conditions:
  14. *
  15. * The above copyright notice and this permission notice (including the
  16. * next paragraph) shall be included in all copies or substantial portions
  17. * of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  22. * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
  23. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  24. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. *
  27. **************************************************************************/
  28. /*
  29. * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  30. *
  31. * While no substantial code is shared, the prime code is inspired by
  32. * drm_prime.c, with
  33. * Authors:
  34. * Dave Airlie <airlied@redhat.com>
  35. * Rob Clark <rob.clark@linaro.org>
  36. */
  37. /** @file ttm_ref_object.c
  38. *
  39. * Base- and reference object implementation for the various
  40. * ttm objects. Implements reference counting, minimal security checks
  41. * and release on file close.
  42. */
  43. #define pr_fmt(fmt) "[TTM] " fmt
  44. #include "ttm_object.h"
  45. #include "vmwgfx_drv.h"
  46. #include <linux/list.h>
  47. #include <linux/spinlock.h>
  48. #include <linux/slab.h>
  49. #include <linux/atomic.h>
  50. #include <linux/module.h>
  51. #include <linux/hashtable.h>
  52. MODULE_IMPORT_NS("DMA_BUF");
  53. #define VMW_TTM_OBJECT_REF_HT_ORDER 10
  54. /**
  55. * struct ttm_object_file
  56. *
  57. * @tdev: Pointer to the ttm_object_device.
  58. *
  59. * @lock: Lock that protects the ref_list list and the
  60. * ref_hash hash tables.
  61. *
  62. * @ref_list: List of ttm_ref_objects to be destroyed at
  63. * file release.
  64. *
  65. * @ref_hash: Hash tables of ref objects, one per ttm_ref_type,
  66. * for fast lookup of ref objects given a base object.
  67. *
  68. * @refcount: reference/usage count
  69. */
  70. struct ttm_object_file {
  71. struct ttm_object_device *tdev;
  72. spinlock_t lock;
  73. struct list_head ref_list;
  74. DECLARE_HASHTABLE(ref_hash, VMW_TTM_OBJECT_REF_HT_ORDER);
  75. struct kref refcount;
  76. };
  77. /*
  78. * struct ttm_object_device
  79. *
  80. * @object_lock: lock that protects idr.
  81. *
  82. * This is the per-device data structure needed for ttm object management.
  83. */
  84. struct ttm_object_device {
  85. spinlock_t object_lock;
  86. struct dma_buf_ops ops;
  87. void (*dmabuf_release)(struct dma_buf *dma_buf);
  88. struct idr idr;
  89. };
  90. /*
  91. * struct ttm_ref_object
  92. *
  93. * @hash: Hash entry for the per-file object reference hash.
  94. *
  95. * @head: List entry for the per-file list of ref-objects.
  96. *
  97. * @kref: Ref count.
  98. *
  99. * @obj: Base object this ref object is referencing.
  100. *
  101. * @ref_type: Type of ref object.
  102. *
  103. * This is similar to an idr object, but it also has a hash table entry
  104. * that allows lookup with a pointer to the referenced object as a key. In
  105. * that way, one can easily detect whether a base object is referenced by
  106. * a particular ttm_object_file. It also carries a ref count to avoid creating
  107. * multiple ref objects if a ttm_object_file references the same base
  108. * object more than once.
  109. */
  110. struct ttm_ref_object {
  111. struct rcu_head rcu_head;
  112. struct vmwgfx_hash_item hash;
  113. struct list_head head;
  114. struct kref kref;
  115. struct ttm_base_object *obj;
  116. struct ttm_object_file *tfile;
  117. };
  118. static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf);
  119. static inline struct ttm_object_file *
  120. ttm_object_file_ref(struct ttm_object_file *tfile)
  121. {
  122. kref_get(&tfile->refcount);
  123. return tfile;
  124. }
  125. static int ttm_tfile_find_ref_rcu(struct ttm_object_file *tfile,
  126. uint64_t key,
  127. struct vmwgfx_hash_item **p_hash)
  128. {
  129. struct vmwgfx_hash_item *hash;
  130. hash_for_each_possible_rcu(tfile->ref_hash, hash, head, key) {
  131. if (hash->key == key) {
  132. *p_hash = hash;
  133. return 0;
  134. }
  135. }
  136. return -EINVAL;
  137. }
  138. static int ttm_tfile_find_ref(struct ttm_object_file *tfile,
  139. uint64_t key,
  140. struct vmwgfx_hash_item **p_hash)
  141. {
  142. struct vmwgfx_hash_item *hash;
  143. hash_for_each_possible(tfile->ref_hash, hash, head, key) {
  144. if (hash->key == key) {
  145. *p_hash = hash;
  146. return 0;
  147. }
  148. }
  149. return -EINVAL;
  150. }
  151. static void ttm_object_file_destroy(struct kref *kref)
  152. {
  153. struct ttm_object_file *tfile =
  154. container_of(kref, struct ttm_object_file, refcount);
  155. kfree(tfile);
  156. }
  157. static inline void ttm_object_file_unref(struct ttm_object_file **p_tfile)
  158. {
  159. struct ttm_object_file *tfile = *p_tfile;
  160. *p_tfile = NULL;
  161. kref_put(&tfile->refcount, ttm_object_file_destroy);
  162. }
  163. int ttm_base_object_init(struct ttm_object_file *tfile,
  164. struct ttm_base_object *base,
  165. bool shareable,
  166. enum ttm_object_type object_type,
  167. void (*refcount_release) (struct ttm_base_object **))
  168. {
  169. struct ttm_object_device *tdev = tfile->tdev;
  170. int ret;
  171. base->shareable = shareable;
  172. base->tfile = ttm_object_file_ref(tfile);
  173. base->refcount_release = refcount_release;
  174. base->object_type = object_type;
  175. kref_init(&base->refcount);
  176. idr_preload(GFP_KERNEL);
  177. spin_lock(&tdev->object_lock);
  178. ret = idr_alloc(&tdev->idr, base, 1, 0, GFP_NOWAIT);
  179. spin_unlock(&tdev->object_lock);
  180. idr_preload_end();
  181. if (ret < 0)
  182. return ret;
  183. base->handle = ret;
  184. ret = ttm_ref_object_add(tfile, base, NULL, false);
  185. if (unlikely(ret != 0))
  186. goto out_err1;
  187. ttm_base_object_unref(&base);
  188. return 0;
  189. out_err1:
  190. spin_lock(&tdev->object_lock);
  191. idr_remove(&tdev->idr, base->handle);
  192. spin_unlock(&tdev->object_lock);
  193. return ret;
  194. }
  195. static void ttm_release_base(struct kref *kref)
  196. {
  197. struct ttm_base_object *base =
  198. container_of(kref, struct ttm_base_object, refcount);
  199. struct ttm_object_device *tdev = base->tfile->tdev;
  200. spin_lock(&tdev->object_lock);
  201. idr_remove(&tdev->idr, base->handle);
  202. spin_unlock(&tdev->object_lock);
  203. /*
  204. * Note: We don't use synchronize_rcu() here because it's far
  205. * too slow. It's up to the user to free the object using
  206. * call_rcu() or ttm_base_object_kfree().
  207. */
  208. ttm_object_file_unref(&base->tfile);
  209. if (base->refcount_release)
  210. base->refcount_release(&base);
  211. }
  212. void ttm_base_object_unref(struct ttm_base_object **p_base)
  213. {
  214. struct ttm_base_object *base = *p_base;
  215. *p_base = NULL;
  216. kref_put(&base->refcount, ttm_release_base);
  217. }
  218. struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
  219. uint64_t key)
  220. {
  221. struct ttm_base_object *base = NULL;
  222. struct vmwgfx_hash_item *hash;
  223. int ret;
  224. spin_lock(&tfile->lock);
  225. ret = ttm_tfile_find_ref(tfile, key, &hash);
  226. if (likely(ret == 0)) {
  227. base = hlist_entry(hash, struct ttm_ref_object, hash)->obj;
  228. if (!kref_get_unless_zero(&base->refcount))
  229. base = NULL;
  230. }
  231. spin_unlock(&tfile->lock);
  232. return base;
  233. }
  234. struct ttm_base_object *
  235. ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint64_t key)
  236. {
  237. struct ttm_base_object *base;
  238. rcu_read_lock();
  239. base = idr_find(&tdev->idr, key);
  240. if (base && !kref_get_unless_zero(&base->refcount))
  241. base = NULL;
  242. rcu_read_unlock();
  243. return base;
  244. }
  245. int ttm_ref_object_add(struct ttm_object_file *tfile,
  246. struct ttm_base_object *base,
  247. bool *existed,
  248. bool require_existed)
  249. {
  250. struct ttm_ref_object *ref;
  251. struct vmwgfx_hash_item *hash;
  252. int ret = -EINVAL;
  253. if (base->tfile != tfile && !base->shareable)
  254. return -EPERM;
  255. if (existed != NULL)
  256. *existed = true;
  257. while (ret == -EINVAL) {
  258. rcu_read_lock();
  259. ret = ttm_tfile_find_ref_rcu(tfile, base->handle, &hash);
  260. if (ret == 0) {
  261. ref = hlist_entry(hash, struct ttm_ref_object, hash);
  262. if (kref_get_unless_zero(&ref->kref)) {
  263. rcu_read_unlock();
  264. break;
  265. }
  266. }
  267. rcu_read_unlock();
  268. if (require_existed)
  269. return -EPERM;
  270. ref = kmalloc_obj(*ref);
  271. if (unlikely(ref == NULL)) {
  272. return -ENOMEM;
  273. }
  274. ref->hash.key = base->handle;
  275. ref->obj = base;
  276. ref->tfile = tfile;
  277. kref_init(&ref->kref);
  278. spin_lock(&tfile->lock);
  279. hash_add_rcu(tfile->ref_hash, &ref->hash.head, ref->hash.key);
  280. ret = 0;
  281. list_add_tail(&ref->head, &tfile->ref_list);
  282. kref_get(&base->refcount);
  283. spin_unlock(&tfile->lock);
  284. if (existed != NULL)
  285. *existed = false;
  286. }
  287. return ret;
  288. }
  289. static void __releases(tfile->lock) __acquires(tfile->lock)
  290. ttm_ref_object_release(struct kref *kref)
  291. {
  292. struct ttm_ref_object *ref =
  293. container_of(kref, struct ttm_ref_object, kref);
  294. struct ttm_object_file *tfile = ref->tfile;
  295. hash_del_rcu(&ref->hash.head);
  296. list_del(&ref->head);
  297. spin_unlock(&tfile->lock);
  298. ttm_base_object_unref(&ref->obj);
  299. kfree_rcu(ref, rcu_head);
  300. spin_lock(&tfile->lock);
  301. }
  302. int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
  303. unsigned long key)
  304. {
  305. struct ttm_ref_object *ref;
  306. struct vmwgfx_hash_item *hash;
  307. int ret;
  308. spin_lock(&tfile->lock);
  309. ret = ttm_tfile_find_ref(tfile, key, &hash);
  310. if (unlikely(ret != 0)) {
  311. spin_unlock(&tfile->lock);
  312. return -EINVAL;
  313. }
  314. ref = hlist_entry(hash, struct ttm_ref_object, hash);
  315. kref_put(&ref->kref, ttm_ref_object_release);
  316. spin_unlock(&tfile->lock);
  317. return 0;
  318. }
  319. void ttm_object_file_release(struct ttm_object_file **p_tfile)
  320. {
  321. struct ttm_ref_object *ref;
  322. struct list_head *list;
  323. struct ttm_object_file *tfile = *p_tfile;
  324. *p_tfile = NULL;
  325. spin_lock(&tfile->lock);
  326. /*
  327. * Since we release the lock within the loop, we have to
  328. * restart it from the beginning each time.
  329. */
  330. while (!list_empty(&tfile->ref_list)) {
  331. list = tfile->ref_list.next;
  332. ref = list_entry(list, struct ttm_ref_object, head);
  333. ttm_ref_object_release(&ref->kref);
  334. }
  335. spin_unlock(&tfile->lock);
  336. ttm_object_file_unref(&tfile);
  337. }
  338. struct ttm_object_file *ttm_object_file_init(struct ttm_object_device *tdev)
  339. {
  340. struct ttm_object_file *tfile = kmalloc_obj(*tfile);
  341. if (unlikely(tfile == NULL))
  342. return NULL;
  343. spin_lock_init(&tfile->lock);
  344. tfile->tdev = tdev;
  345. kref_init(&tfile->refcount);
  346. INIT_LIST_HEAD(&tfile->ref_list);
  347. hash_init(tfile->ref_hash);
  348. return tfile;
  349. }
  350. struct ttm_object_device *
  351. ttm_object_device_init(const struct dma_buf_ops *ops)
  352. {
  353. struct ttm_object_device *tdev = kmalloc_obj(*tdev);
  354. if (unlikely(tdev == NULL))
  355. return NULL;
  356. spin_lock_init(&tdev->object_lock);
  357. /*
  358. * Our base is at VMWGFX_NUM_MOB + 1 because we want to create
  359. * a seperate namespace for GEM handles (which are
  360. * 1..VMWGFX_NUM_MOB) and the surface handles. Some ioctl's
  361. * can take either handle as an argument so we want to
  362. * easily be able to tell whether the handle refers to a
  363. * GEM buffer or a surface.
  364. */
  365. idr_init_base(&tdev->idr, VMWGFX_NUM_MOB + 1);
  366. tdev->ops = *ops;
  367. tdev->dmabuf_release = tdev->ops.release;
  368. tdev->ops.release = ttm_prime_dmabuf_release;
  369. return tdev;
  370. }
  371. void ttm_object_device_release(struct ttm_object_device **p_tdev)
  372. {
  373. struct ttm_object_device *tdev = *p_tdev;
  374. *p_tdev = NULL;
  375. WARN_ON_ONCE(!idr_is_empty(&tdev->idr));
  376. idr_destroy(&tdev->idr);
  377. kfree(tdev);
  378. }
  379. /**
  380. * get_dma_buf_unless_doomed - get a dma_buf reference if possible.
  381. *
  382. * @dmabuf: Non-refcounted pointer to a struct dma-buf.
  383. *
  384. * Obtain a file reference from a lookup structure that doesn't refcount
  385. * the file, but synchronizes with its release method to make sure it has
  386. * not been freed yet. See for example kref_get_unless_zero documentation.
  387. * Returns true if refcounting succeeds, false otherwise.
  388. *
  389. * Nobody really wants this as a public API yet, so let it mature here
  390. * for some time...
  391. */
  392. static bool __must_check get_dma_buf_unless_doomed(struct dma_buf *dmabuf)
  393. {
  394. return file_ref_get(&dmabuf->file->f_ref);
  395. }
  396. /**
  397. * ttm_prime_refcount_release - refcount release method for a prime object.
  398. *
  399. * @p_base: Pointer to ttm_base_object pointer.
  400. *
  401. * This is a wrapper that calls the refcount_release founction of the
  402. * underlying object. At the same time it cleans up the prime object.
  403. * This function is called when all references to the base object we
  404. * derive from are gone.
  405. */
  406. static void ttm_prime_refcount_release(struct ttm_base_object **p_base)
  407. {
  408. struct ttm_base_object *base = *p_base;
  409. struct ttm_prime_object *prime;
  410. *p_base = NULL;
  411. prime = container_of(base, struct ttm_prime_object, base);
  412. BUG_ON(prime->dma_buf != NULL);
  413. mutex_destroy(&prime->mutex);
  414. if (prime->refcount_release)
  415. prime->refcount_release(&base);
  416. }
  417. /**
  418. * ttm_prime_dmabuf_release - Release method for the dma-bufs we export
  419. *
  420. * @dma_buf:
  421. *
  422. * This function first calls the dma_buf release method the driver
  423. * provides. Then it cleans up our dma_buf pointer used for lookup,
  424. * and finally releases the reference the dma_buf has on our base
  425. * object.
  426. */
  427. static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf)
  428. {
  429. struct ttm_prime_object *prime =
  430. (struct ttm_prime_object *) dma_buf->priv;
  431. struct ttm_base_object *base = &prime->base;
  432. struct ttm_object_device *tdev = base->tfile->tdev;
  433. if (tdev->dmabuf_release)
  434. tdev->dmabuf_release(dma_buf);
  435. mutex_lock(&prime->mutex);
  436. if (prime->dma_buf == dma_buf)
  437. prime->dma_buf = NULL;
  438. mutex_unlock(&prime->mutex);
  439. ttm_base_object_unref(&base);
  440. }
  441. /**
  442. * ttm_prime_fd_to_handle - Get a base object handle from a prime fd
  443. *
  444. * @tfile: A struct ttm_object_file identifying the caller.
  445. * @fd: The prime / dmabuf fd.
  446. * @handle: The returned handle.
  447. *
  448. * This function returns a handle to an object that previously exported
  449. * a dma-buf. Note that we don't handle imports yet, because we simply
  450. * have no consumers of that implementation.
  451. */
  452. int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
  453. int fd, u32 *handle)
  454. {
  455. struct ttm_object_device *tdev = tfile->tdev;
  456. struct dma_buf *dma_buf;
  457. struct ttm_prime_object *prime;
  458. struct ttm_base_object *base;
  459. int ret;
  460. dma_buf = dma_buf_get(fd);
  461. if (IS_ERR(dma_buf))
  462. return PTR_ERR(dma_buf);
  463. if (dma_buf->ops != &tdev->ops)
  464. return -ENOSYS;
  465. prime = (struct ttm_prime_object *) dma_buf->priv;
  466. base = &prime->base;
  467. *handle = base->handle;
  468. ret = ttm_ref_object_add(tfile, base, NULL, false);
  469. dma_buf_put(dma_buf);
  470. return ret;
  471. }
  472. /**
  473. * ttm_prime_handle_to_fd - Return a dma_buf fd from a ttm prime object
  474. *
  475. * @tfile: Struct ttm_object_file identifying the caller.
  476. * @handle: Handle to the object we're exporting from.
  477. * @flags: flags for dma-buf creation. We just pass them on.
  478. * @prime_fd: The returned file descriptor.
  479. *
  480. */
  481. int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
  482. uint32_t handle, uint32_t flags,
  483. int *prime_fd)
  484. {
  485. struct ttm_object_device *tdev = tfile->tdev;
  486. struct ttm_base_object *base;
  487. struct dma_buf *dma_buf;
  488. struct ttm_prime_object *prime;
  489. int ret;
  490. base = ttm_base_object_lookup(tfile, handle);
  491. if (unlikely(base == NULL ||
  492. base->object_type != ttm_prime_type)) {
  493. ret = -ENOENT;
  494. goto out_unref;
  495. }
  496. prime = container_of(base, struct ttm_prime_object, base);
  497. if (unlikely(!base->shareable)) {
  498. ret = -EPERM;
  499. goto out_unref;
  500. }
  501. ret = mutex_lock_interruptible(&prime->mutex);
  502. if (unlikely(ret != 0)) {
  503. ret = -ERESTARTSYS;
  504. goto out_unref;
  505. }
  506. dma_buf = prime->dma_buf;
  507. if (!dma_buf || !get_dma_buf_unless_doomed(dma_buf)) {
  508. DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
  509. exp_info.ops = &tdev->ops;
  510. exp_info.size = prime->size;
  511. exp_info.flags = flags;
  512. exp_info.priv = prime;
  513. /*
  514. * Need to create a new dma_buf
  515. */
  516. dma_buf = dma_buf_export(&exp_info);
  517. if (IS_ERR(dma_buf)) {
  518. ret = PTR_ERR(dma_buf);
  519. mutex_unlock(&prime->mutex);
  520. goto out_unref;
  521. }
  522. /*
  523. * dma_buf has taken the base object reference
  524. */
  525. base = NULL;
  526. prime->dma_buf = dma_buf;
  527. }
  528. mutex_unlock(&prime->mutex);
  529. ret = dma_buf_fd(dma_buf, flags);
  530. if (ret >= 0) {
  531. *prime_fd = ret;
  532. ret = 0;
  533. } else
  534. dma_buf_put(dma_buf);
  535. out_unref:
  536. if (base)
  537. ttm_base_object_unref(&base);
  538. return ret;
  539. }
  540. /**
  541. * ttm_prime_object_init - Initialize a ttm_prime_object
  542. *
  543. * @tfile: struct ttm_object_file identifying the caller
  544. * @size: The size of the dma_bufs we export.
  545. * @prime: The object to be initialized.
  546. * @type: See ttm_base_object_init
  547. * @refcount_release: See ttm_base_object_init
  548. *
  549. * Initializes an object which is compatible with the drm_prime model
  550. * for data sharing between processes and devices.
  551. */
  552. int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size,
  553. struct ttm_prime_object *prime,
  554. enum ttm_object_type type,
  555. void (*refcount_release) (struct ttm_base_object **))
  556. {
  557. bool shareable = !!(type == VMW_RES_SURFACE);
  558. mutex_init(&prime->mutex);
  559. prime->size = PAGE_ALIGN(size);
  560. prime->real_type = type;
  561. prime->dma_buf = NULL;
  562. prime->refcount_release = refcount_release;
  563. return ttm_base_object_init(tfile, &prime->base, shareable,
  564. ttm_prime_type,
  565. ttm_prime_refcount_release);
  566. }